CS105L Introduction to Game Programming Using Alice (Lab)
Fall 2009

LAB 8

Chapter 5 and 6

Covers material from Chapters 5 & 6 in class text; Starting Out with Alice.

Part 1 - Chap 5: Passing an object as a parameter – Marcello the Magician

  1. Complete exercise 5-5 on page 237.
  2. Save the object. Refer to tutorials 5-2 pg 194 and 5-4 on pg 205 for saving objects and passing parameters.

Part 2 – Key pressed events - Spacejet

  1. Complete tutorial 6-2 pg 250 with additional steps below.
  2. Modify your code such that the spacebar causes the Spacejet to hover only. Add additional events to use the arrow buttons to control forward, back, left and right turns.
  3. Extra; complete rest of lab first. Tap the spacebar once to rise. A second tap will land the jet. The keys “s” and “d” will raise or lower the jet in flight. Add banking when the jet is turning. The “x” key will cause an ejecting of the pilot. Add a sounds for when the jet is hovering, turning, and flying.

Part 3 – Mouse clicked events – The fridge

  1. Complete tutorial 6-3 pg 253 with additions below.
  2. Modify your code such that clicking on the door a second time will cause the door to close.
  3. Add code to open/close the freezer door by clicking on the freezer door.

Part 4 – Combining 1 & 2; adding sound.

  1. Create a new world. Add the new magician class you created in part 1.
  2. Modify the code from part 1 such that an object will disappear when clicked on. That is, clicking on an object with the mouse will call the disappear method on that object.
  3. Add a sound effect when the object disappears.
  4. Playing a sound: from the properties tab drag the sound into the editor.



Last modified: 8/19/09
By: David O'Gwynn