Home
Fusion 2.5+
Firefly+
Tutorials+
Videos+
Guides & Tips+
Extensions
Versions
Teaching


Nano War - Spores, mutants and collisions

5. Spores, mutants and collisions


The spores


The aliens shoot at the player some round items that we call the "Spores". They only live for a couple of seconds, and actively look for the player ship. The series of events in this step make the Spores works. Let's detail them.
The first event : at a random time, picks one of the Alien ships, and create a Spore close to it. It then sets it Alterable value to 100. The second event detects when the Alterable value of the Spore reaches zero, and destroys the Spore when it happens. The third event makes sure the Spore directs itself towards the player ship, and subtract one to the Spore's internal counter: the Spore will only live for 100 loops, that is 2 seconds. The final event detects the collision between the Spore and the laser.

  • Every 00"-20

+ Random(100) > 90

+ Pick one of  (surgeon)

: Create (spore) at (-1,2) from (surgeon)

(spore) : Set Alterable Value A to 100

  • Alterable Value A of  (spore) = 0

(spore) : Destroy

  • Always

(spore) : Look at (0,0) from (fighter)

(spore) : Subtract 1 from Alterable Value A

  • Collision between  (spore) and (laser)

(laser) : Destroy

(spore) : Destroy

(Player 1) : Add 100 to Score

The mutant aliens


Alien ships mutates when they reach the top of the screen, and transform themselves in really aggressive ships. The next series of events animate those aliens. The first event creates an alien at a random position on the playfield. Its movement will make it go toward the top of the screen. The second event detects when the alien reaches the top, and when it does, creates a new alien in place of the first one. The last condition simply detects when the player's laser destroys the original alien.

  • Every 01"-00

+ Random(100) > 90

: Create (mutant_alien) at (239,453)

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

  • (mutant_alien) leaves the play area on the top

: Create (alien) at (1,2) from (mutant_alien)

(mutant_alien) : Destroy

Collision between  (laser) and (mutant_alien)

(mutant_alien) : Destroy

(laser) : Destroy

(Player 1) : Add 500 to Score

We have not finished with the mutant aliens. We still need to detect the collision between the mutant alien and the player's laser to destroy the alien. This is done by the first event of this step. The second event makes sure that the alien actively looks for the player's ship by constantly making it look at the ship.

  • Collision between  (laser) and (alien)

(alien) : Destroy

(laser) : Destroy

(Player 1) : Add 1000 to Score

Some more collisions


We have entered events to detect the collisions with the laser, but no events to detect the collisions with the ship. Each time an enemy collides with the player's ship, we subtract one to the number of lives of the player, and restart the frame: the game will start again at the beginning. The events in this step are self-explanatory: they detect the collision with each one of the different enemies.

  • Collision between  (spore) and (fighter)

(Player 1) : Subtract 1 from Number of Lives

: Restart current frame

  • Collision between (surgeon) and (fighter)

(Player 1) : Subtract 1 from Number of Lives

: Restart current frame

  • Collision between (alien) and (fighter)

(Player 1) : Subtract 1 from Number of Lives

: Restart current frame

  • Collision between (mutant_alien) and (fighter)

(Player 1) : Subtract 1 from Number of Lives

: Restart current frame




Spread the word!



You can share this document using the following buttons.




Submit your own User Tip