Chapter Five  Beginning Game Programming With Flash

 

1.      Modify the program so that the enemy1, enemy2 and enemy3 objects move across the sky from left to right instead of moving downward toward the ground on the stage.

 

a)      What changes will have to be made to the ActionScript 3.0 code?

 

b)      Rewrite the moveEnemy2() function with your group.

 

2.      Suppose we wish to have a variety of speeds for the enemy1, enemy2 and enemy3 objects, to make the game more interesting.

 

a)      How would you declare three variables named speed1, speed2 and speed3 to be the respective random speeds of the enemy1, enemy2 and enemy3 alien spaceships?

 

b)      What statement would set speed1 to a random number between 5 and 10, so that the speed value we would use for enemy1 would be >= 5 and < 10? (or <= 5 and <= 10)?

 

c)      Where would you place this statement that assigns speed1 a random value? Hint: You need to put it in at least two places, perhaps 3 places.

 

3.      How in Flash would you get the spaceships to be pointing eastward instead of downward, so they can look like they are flying across the stage from left to right?

 

a)      What menu, and what command on that menu, would you use to make the change to the alien spacecraft?

 

4.      Modify the chapter 5 program so that it does NOT use the mouse to fire missiles or to move the tank. We will use the Keyboard to allow the game player to move the tank and to fire the missile from the tank.

 

5.      What changes do you need to make to the program so that it uses the left and the right arrow keys to move the tank, and the space bar to fire missiles? Where would you make these changes?

 

6.      How would you modify the Flash application so that the missiles reach the alien spacecraft?

 

a)      Notice that the missiles seem to vanish long before they reach the top of the stage.

 

b)      If enemy1, enemy2, or enemy3 gets a very small random y value, it will be flying across the stage very high in the sky. The missile has to be able to reach the alien spacecraft.

 

7.      What changes need to be made to the detectCollision function? How are these changes simpler after you have finished deciding how to make changes and what changes to make for the moveEnemy1(), moveEnemy2() and moveEnemy3 functions?