CompSci 4 - Classwork - Sep 14, 2006
10 pts
Today's classwork goes along with Chapter 4, Section 1.
You will create three Alice worlds today.
The following work needs to be checked off when you have completed it.
- Copy your previous "snowman tries to meet snowwoman"
world (from Chapter 2, section 2) and rename it to snowmanFliphat.a2w.
You will modify this world
to create two methods.
- catchAttention World method - The snowman should turn to face the camera, say Ahem,
and then turn to face the snowwoman. This method should be called
twice in your "my first world" method with the snowman moving forward
between the calls.
- flipHats World method - The snowman uses his right arm to tip his hat
and the snowwoman's hat moves up and down quickly.
This method should be called at least twice
in your "myFirstWorld" method.
- Moving a camera along with an object and go to the NC State Fair!
In this part you will setup a Camera view to move with an object.
All the code entered will be placed into world.myFirstMethod.
- Download skyride.a2w from the CompSci 4 calendar page for today.
(Reminder: if your laptop renames the file as a .zip file, you will need
to rename it back to an .a2w world.)
- Play the world to see what it does. The world has a
fair ride of skycars. All the skycars start at the same position, then
one by one they move across and back, ending at the same position.
Skyride.Car1 is first, followed by Skyride.Car2, followed by Skyride.Car3.
- Create a Dummy Camera object called originalPosition, to save
the original camera position (always a good idea!).
- In world.myFirstMethod add a new command in the program
BEFORE
Skyride.skyrideAnimation. The command to add is for the camera
object to set the point of view to the
Skyride.Car2. This adds the point of view to the roof of SkyRide.Car2.
To get the riders perspective, add a command after this one to move the
camera down 0.5 meters.
- Play the world to see what happens. Why doesn't the camera move?
- Add a command to the program immediately after the last
command you added and before SkyRide.skyrideAnimation.
The command to add is to make the camera move when SkyRide.Car2 moves.
(see vehicle property from last class).
- Add one last command after SkyRide.skyrideAnimation to set the point
of view of the camera
back to the original position.
- Problem 4 Helicopter Flight on page 111 (recopied here).
Create a world (name
it helicopterFlight.a2w, with a helicopter (Vehicles folder),
airport(Buildings), and a control tower(Buildings). Create a
circleTower method that makes the helicopter fly toward
the control tower and then around it. In myFirstMethod,
call the circleTower method twice and then make the helicopter
land on the airport landing strip.
If you finish early, feel free to embelish your animations.