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


The obstacles

The obstacles


The pine trees


Lets concentrate on the pine trees now. Every second we will create a pine tree in the bottom of the screen and then set its horizontal position at random. We will at the same time add a few points to the score of the player. This tree will then move toward the top of the screen by substracting the value of the "Speed" counter to its vertical coordinate. The pine tree will be destroyed when it reaches the top of the screen.

The "Random" expression can be found in the system object expressions.

  • Every 01"-00

: Create (pine) at (332,555) layer 1

(pine) : Set X position to Random(640)

(pine) : Bring to back

 (Player 1) : Add 50 to Score

  • Always

(pine) : Set Y position to Y( "  (pine)" ) - value( "  (speed)" )

  • Y position of  (pine) <= -100

(pine) : Destroy

The rocks


The rocks are programmed using the exact same method.

  • Every 00"-90

: Create (rock) at (331,542) layer 1

(rock) : Set X position to Random(640)

(rock) : Bring to back

 (Player 1) : Add 150 to Score

  • Always

(rock) : Set Y position to Y( "  (rock)" ) - value( "  (speed)" )

  • Y position of  (rock) <= -100

(rock) : Destroy

Moving the obstacles


We need now to make everyone move : we only have to modify the value of the "Speed" counter depending on the timer. The bigger the value of the timer, the faster the obstacles will move.
Once you have entered the following events, you can launch the game and watch the trees and the rocks rush at you.

  • Start of Frame

 (speed) : Set Counter to 3

  • Timer equals 30"-00

 (speed) : Set Counter to 4

  • Timer equals 01'00"-00

 (speed) : Set Counter to 5

  • Timer equals 01'30"-00

 (speed) : Set Counter to 6

  • Timer equals 02'00"-00

 (speed) : Set Counter to 7

  • Timer equals 02'30"-00

 (speed) : Set Counter to 10

  • Timer equals 03'00"-00

 (speed) : Set Counter to 15




Spread the word!



You can share this document using the following buttons.




Submit your own User Tip