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


Faulty Flap: 3. The background obstacles

Step 3 of 6: Adding the background obstacles

This tutorial was written by:
Olivier Behr

The bird can move anywhere vertically. We will end the game when the bird moves too high or too low.

 

Frame Editor Icon In the Frame Editor > Layers Toolbar make sure that Layer 2 is selected. From the Library Window dragobstacle.Backdrop in the Frame at coordinates (0,656) right below horizon.Active. Duplicate it by holding Ctrl and drag it above the Frame at coordinates (0,-192).

 

  • obstacle.Backdrop: background obstacle

This Quick Backdrop object is setup as Obstacle in the Object Properties > Runtime Options tab.

 

Your Frame should look like this:

 

Event List Editor Icon In the Event List Editor insert a new group of events called Game.Outro and uncheck Active when frame starts. For the moment this group won't contain any event. Move this group right after the Game.Play group.
Then add the following event in the Game.Play group:

Game.Play
Bird hits background
  •   (bird.Active) collides with the background

  : Play sample lose

  : Activate group "Game.Outro"

  : Deactivate group "Game.Play"

What happens with this event? When the bird hits the background obstacles we deactivate the Game.Play group where we test for the player input, preventing any further jumps. We also activate the Game.Outro group for later use.

Event List Editor Icon Now add the following event after the other events in the bird.Active group:

bird.Active
Bird hits background
  •   (bird.Active) collides with the background

  (bird.Active) : Stop

  (bird.Active) : Stop animation

  : Deactivate group "bird.Active"

What happens with this event? When the bird hits the background obstacles we deactivate the bird.Active group which is making him fall. We also stop its Movement and its Animation.

We use two events both testing for background collisions. Please read on to find out why. It will become obvious once that we are finished dealing with the collisions.

Run Application Icon Run the application. As soon as the bird hits one of the background obstacles, the one above the Frame or the one at the bottom of the Frame, the game is over.

For easier testing use the left-most button (Rewind) of the debugger to restart the Frame.
The debugger window is displayed on the top-left corner of the screen. If you don't see it check the Application Properties > Settings tab and make sure that Show Debugger is checked.




Spread the word!



You can share this document using the following buttons.




Submit your own User Tip