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.

  1. 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.

  2. 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.

    1. 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.)

    2. 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.

    3. Create a Dummy Camera object called originalPosition, to save the original camera position (always a good idea!).

    4. 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.

    5. Play the world to see what happens. Why doesn't the camera move?

    6. 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).

    7. Add one last command after SkyRide.skyrideAnimation to set the point of view of the camera back to the original position.

  3. 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.