In this tutorial you will be adding firepower to your ship from the previous lesson!
On top of using the keyboard to move your ship around the scene, you will also press a key (space bar) to fire a projectile at the asteroid. If your projectile collides with the asteroid the asteroid will be destroyed (along with the projectile).
Click in the window above (so the game has focus instead of the surrounding web page) and then use the arrow keys to follow the asteroids and press the spacebar to fire!
1) Start Multimedia Fusion and close the "Tip of the day" box.
2) If you don't see the MMF libraries window click VIEW - Multimedia Fusion Libraries
3)
Open your previous lesson fileor begin a New - Application and start the frame editor and drag out 4 objects, 1 that will be the player (character, ship)
, 1 that will be the enemy/target, 1 object that will be the projectile your player object will shoot (place this just off the stage) and drag out a space theme backdrop.
Open the Event Editor and right click New condition and then the keyboard/mouse icon, selecting The keyboard - Upon pressing a key. You will be prompted to press a key. Press the space bar. This will be the key you press to fire a projectile from your ship.
For this new event row "Upon pressing Space bar" right click in the spaceship column and select "Shoot an Object"
A panel of available objects will appear. Select and OK your projectile object.
You will now be prompted for shooting options. The default speed is 100 and the direction default is "Use the direction of Saucer" so just click OK. Perhaps in another game you may need the other Direction options because you wish to only shoot straight up or maybe shoot toward a specifc object.
To conclude this lesson we need to have the projectile destroy the asteroid and vice versa. From your experience on the previous lesson create a new collision event (New condition) between the bullet and the asteroid. In this new row go across to the bullet and asteroid column and right click choosing Destroy in both boxes.
Now when you press the play icon you will see that your ship shoots and destroys the asteroid. If you haven't already, in the frame editor copy and paste additional asteroids so you have more targets to shoot. In the next lesson the asteroids will bite back and you will be managing score and lifes!
Tips:
In the Help menu take advantage of Help Topics Challenge: Make the asteroid ball to fire at you!