The Flapping bird template uses the Platform behavior to handle the “flight” of the bird you are controlling.
The goal of the game is to guide the bird through pipes, without touching them or the ground by applying an impulse to the bird each time the players touches the screen.
Pipes are randomly created on a regular basis in an infinitely scrolling level.
Each time the bird goes successfully through pipes, the player receives a point.
Here, the Platform behavior is not used in the expected way of having the bird standing on top of platforms. The behavior is used for its capacity to simulate jumps.
Once a jump is going on, then the fall phase follows it, making the bird move down to the ground if another jump is not triggered by the player.
This input of the player is handled by the Touch plugin.
Touch will allow you to determine if the player has touched (touched down and released their finger), is in touch, is touching a specific object, and various other related touch inputs on devices that can handle it.
Touch handles also mouse inputs on desktop computers.
This template, as with most templates, implements the game mechanic elements.
You can build upon it by adding more graphics, implementing your own mechanics, adding sounds and music, new layouts …
The base mechanics and game loop are implemented.
A game loop is when the player is interacting with the world of your game, in the rules you have set up for it, attempting to fulfil the winning conditions while avoiding the death conditions.
For Flapping Bird, the world is a horizontal game area in which pipes are randomly created.
The player controls a bird and guides it through the pipes.
If the bird hits a pipe or hits the ground, the game stops, the death/losing conditions have been met.
In this setup, there are no actual winning conditions that will stop the game loop.
The game is set so that the players “dies” at some point.
You could say in this case, that the winning condition for the player is to manage to keep the bird flying and avoiding the obstacles.
As long as the player is successfully doing so, they are fulfilling the winning conditions.
At the moment they hit an obstacle, the game is over.
The player is allowed to progress by going through more pipes (scoring higher) than in their previous attempts.
An example of a winning condition that will end the game with the player having “won the game” can be found in the game demo Demonoire.
In this RPG, the winning condition is to defeat the final boss of the dungeon.
When the player does so, the game stops and the player is rewarded for having completed the game.
Death conditions in Demonoire do not actually stop the game.
The character is brought back out of the dungeon, with the only penalty of starting over the room they were in when their HP dropped to 0.
In most of those selected templates, we have a game loop that will only be stopped by losing conditions.