Flash worksheets - Exercise 9

Exercise 9 Create the Game Logic (1)

Objective - get mcGunship moving with left and right arrow keys, spacebar will fire mcBullet and mcBullet will fly

  1. study the sample code and annotate for moving mcGunship
  2. alter the sample code and test for different speed.
  3. study the code for adding bullet, alter code for firing a bullet when spacebar pressed.
  4. study the code for bullet flying. Alter thecode for your bullet movement
  5. when finished, annotate your code in detail for your portfolio.

 

Exercise 10 Create the Game Logic (2)

Objective - layout an array of mcAliens and make them move left/right/downward

  1. determine how many aliens per row and how many rows to start with.
  2. create the aliens and place them in a matrix, and in an array
  3. alter the sampel code to suit your own need
  4. when finished, annotate your code in detail for your portfolio.

Exercise 11 Create the Game Logic (3)

Objective - make mcAlienSpaceship fly, use hitTestObject() to check collisions and scores

Exercise 12 Create the Game Logic (4)

Objective - displays, lives and try again

Exercise 13 Create the Game Logic (5)

Objective - level up

Exercise 15 Create the Game Logic (6)

Objective - System testing and debugging

 

Exercise 14 Publish the Game

Exercise 15 Write the User Manual and Technical Manual

 

The main methods of adding children and controlling their depth are:

These are the basic methods, there are more of them. The main thing to remember is the all the children are always placed on depths 0,1,..,theContainer.numChildren-1. Thus the line:

theContainer.setChildIndex(existingChildName, theContainer.numChildren-1);

places the said child in front of all other children.

On the next two pages of this tutorial, we will show a 3D and a drag and drop examples where depths control is important.