Fusion 2.5+
Guides & Tips+

Nano War - Shoot, create, destroy

4. Shoot, create, destroy

Shooting bullets

Let's make the ship shoot bullets. Notice that we simply test for the Shift key to be down, and launch a "laser" object. Then we destroy the "Laser" object when it gets out of the playfield.

  •   (Player 1) Pressed fire 1

 (fighter) : Launch  (laser) et speed 100

Creating the aliens

We now have to create the aliens. We are going to use the counter we dropped for this purpose: when the counter is greater than zero, we create an alien ship that we position randomly in the playfield. And subtract one to the counter. Every 10 seconds we reset the counter to 6.

  • Start of frame

(Creation surgeon) : Set Counter to 7

  • Every 10"-00

(Creation surgeon) : Set Counter to 6

  •   (Creation surgeon) > 0

: Create  (surgeon) at (263,452)

(surgeon) : Set X position to Random(1920)

(Creation surgeon) : Subtract 1 from Counter

  • Every 05"-00

(surgeon) : Look at (-3,2) from  (fighter)

Destroying the aliens

When the player's bullet collides with an alien, the alien is destroyed. This can be done very simply in one event, starting with collision detection.

  • Collision between  (laser) and  (surgeon)

(surgeon) : Destroy

(Player 1) : Add 200 to Score

(laser) : Destroy

Spread the word!

You can share this document using the following buttons.

Submit your own User Tip