Lab 1: Introduction to Programming in
Alice
Introduction
The purpose of this lab is to get comfortable creating
animations using Alice. Save your work frequently. When you finish
an exercise show your work to the lab instructor or a TA.
Be sure to comment your code. At a minimum you should include
a comment at the beginning of your code with your name, the date, and
a one sentence description of the project.
Introducing the Two Star CS105 Lab/Mini-Lab Rating System
Each of the exercises in this Lab are rated on a two star
scale.
- * One star exercises are the central content of the lab. You are
required to do these exercises, and they have been constructed so that
most students should have time to finish before the end of the
period.
- ** Two star exercises are generally more challenging. You may
not be able to finish the exercise during the lab period, but if you
have time you should take a crack at it and get as much done as
possible.
Exercises
-
Hare Snack *
Create a world containing a hare, a stool, and a candy cane.
Place the candy on the stool, and the hare several meters away from
the candy. Create an animation in which the hare moves to the stool
and looks at the candy, then looks at the camera and waves his ears
back and forth in a gesture of gratitude.
-
Supernova *
For this exercise we will animate the final moments in the life of a
small solar system. Create a world containing three spheres: the
star, a planet, and a moon to orbit the planet. The spheres should be
given appropriate sizes and positions for their roles. Giving each of
the spheres descriptive names will make it easier to keep them straight
in your code.
Your animation should illustrate the last two years in the life of
this solar system. During the first year of the animation the planet
should orbit the star exactly once (obviously). In the time that it
takes for the planet to complete one orbit, the moon should complete
three orbits around the planet. The second year should proceed
exactly as the first, with the exception of the supernova. During the
course of the year the sun should expand to several times its initial
size, engulfing the planet and its moon. The star should then shrink
down to a fraction of its initial size. The planet and moon should no
longer be visible after they have been engulfed by the supernova.
HINTS:
- The easiest way to create the orbit effect is to make the sun the
vehicle for the planet. Then, rotating the sun will cause the planet
to turn. The same trick can be used to make the moon orbit the
planet.
- There are several ways to make an object "disappear":
- It could be resized to be very very small.
- The "isShowing" property could be changed to "false". (p. 35 in
your Alice book).
- The "opacity" property could be set to 0.
- Getting this animation to look right will probably require working with
method arguments such as "duration" and "style". (p. 41 in your Alice
book.)
Extras**
- Put a light-bulb inside the star, and turn off the existing light
source. You should now be able to see day and night on the moon and
planet.
- Apply textures to the moon and planet (p. 64 in your Alice book).
-
Roll Your Own **
Create your own interesting animation. You could either animate the
world you set up in class on Wednesday, or create a new world from
scratch.