Sie sind auf Seite 1von 7

Firing at the Space Invaders

1. Load the starter file – ‘Firing invaders starter’

2. Use your Flash skills to draw a bullet – you could use the Rectangle Tool
to create it:

Here we’ve drawn a small


yellow rectangle which can
act as the bullet. Don’t
make it too large…

3. Click on the black arrow (Selection tool) and then click on your bullet.
Make sure it is selected – you should see dots
over it
4. Press the F8 key and turn your bullet into a Movie clip symbol. Call it
‘bullet’ and press OK.

5. Click on your new bullet symbol to select it. At the bottom of your
screen you should see the Properties panel:

6. Now add a name in for the bullet. Call it ‘bullet0’ [bullet with a zero]
7. Next we need to add some code to the bullet. Click on your bullet again
and press the F9 key to open the Actionscript panel.

8. Click on the link for ‘Actionscript code (.txt file)’ – this will open up the
code you need.

9. Copy this code and – making sure you have selected the bullet – paste it
into the Actions panel:

10. Check: Have you added the code in the correct


place? It should be directly on the bullet. Look at
your timeline to check – if a small ‘a’ character has
appeared then it has gone wrong. Delete the code
and try again.
11. We now need to add some code to the player ship to make it fire the
bullet. This time you’ve got most of the code, but you need to figure out
one part yourself.

12. Click on ‘Player ship Actionscript (.txt file)’ to load the next code. Copy
the code when it appears.

13. Click on the player ship and look in the Actions panel (can you
remember what key to press if you cannot see the Actions panel?)

14. You should recognise the code from the previous session – this code
makes the player ship move left and right. Paste the new code
underneath:

15. Unfortunately, the code is incomplete! You need to find the correct
place to add the word ‘Space’ into the code. It must be typed in exactly
as shown, with a capital ‘S’. This will fire the bullet when the player
presses the space bar.
16. Move the bullet off the main stage – put it on the side of the game. This
is to prevent a stray bullet appearing in the game.

17. Save your work and then press ‘File’ > ‘Publish Preview’ > ‘Flash’. It is
nearly ready to play.

18. The final step is to ‘name’ each of the Space Invaders. This is so we can
make them disappear when they are hit. Click on the top left alien.
19. We need to name this Space Invader – click in the empty name box in
the Properties panel. Type the number ‘1’ as the name:

20. Repeat step 19 so you name each one of the Invaders. Give each one
its own number between 2 and 21.
21. Check that you have named all of the Space Invaders. If you miss any
out, they won’t be able to be destroyed!

22. Finally, press ‘File’ > ‘Publish Preview’ and ‘Flash’ to play your game.

Your next challenge is to get your own Space Invaders game firing too. To add
the feature into your own game, you need to:

 Copy and paste your bullet Movie clip into your own file
 Copy and paste the ‘explode’ symbol (that is in the library)
 Add the firing code to your own space ship
 Name each of your own Space Invaders

See if you can turn your version into a real game!

Das könnte Ihnen auch gefallen