This is the fourth and final part to the "how to create the Space Shooter game from scratch" tutorial. Click on one of the following links to view a different section:
Part 1
Part 2
Part 3The final thing to do in your game is too hook up the won and lost scenes. To hook up the Won scene, you will need to add a scene change behavior.
1. Go to the Scenes area
2. Select the Main scene
3. Click on Behaviors
4. Add a new Scene Change behavior
5. Select the Event button for this new behavior
6. Select the Property Change event
In each scene, Popfly keeps track of how many instances of an actor there are. When there are no more enemy spaceships, then the person playing the game has won!

Property change event (before)
7. Click the Game button
8. Select "A scene" from the options in the dialog that appears
9. Click on the Main scene
10. Click the "x" button to exit the chooser dialog
11. Ensure that the property is "# of Flying Saucer"
12. Instead of "changes to any value", change it so it's "=" and "0", as is shown below:

Property change event (after)
13. Click the "x" button to exit the event dialog
14. Click on the scene button to select the scene that you want to switch to
15. Click on the Won scene
Next, you need to hook up the Lost scene. In this game, the player loses when when their hero spaceship (Flighter Spaceship) is destroyed/disappears. Since the Fighter Spaceship knows when it disappears, it's best to add this behavior to that actor.
16. Return to the Actors area
17. Select the Fighter Spaceship actor
18. Click on the Behaviors
19. Add a Scene Change behavior
20. Click the Event button for the new behavior
21. Change the event from Load to Disappear, and exit the dialog
22. Click on the Scene button for the behavior
23. Select the Lost scene
Before you go and play your game, there is one last recommended change:
There is a default behavior called "DisappearOnSceneLeave" - this causes the game to transition to the Lost scene when the actor leaves the scene. Because it can be easy for a player to accidentally move the Fighter Spaceship off the scene, it is recommended that you remove this behavior:
24. Remove the "DisappearOnSceneLeave" behavior by clicking on the "x" next to the behavior name.
Your game is now ready to be played! Press the Play! button to try your game out. You can further improve your game by doing some of the following:
- Add a score actor
- Add an explosion effect when a spaceship disappears
- Change the speed of the spaceships and the projectiles (faster or slower)
- Edit the intro, won and lost scenes to further customize your game
- Add instructions to the How to Play scene
Have fun exploring the Popfly Game Creator!