Interacting with the player, first version: guessing the right number
The minigame Numbers demonstrates the easiest way to collect interaction from a player, in the specific case to get the right number of apples and of bananas - that are in different mini-minigames !
When the Numbers is launched, the player's first challenge is on apples:
This is implemented with the Game1 Layer
there you see the Apple Sprite and then four Sprite numbered 1, 5, 8, 10 and called
1btn, 5btn, 8btn, 10btn. They all have the Flash and the Fade behavior.
The respective Numbers Event Sheet follows:
initialisation is just setting the scrollX and scrollY coordinates,
touching 5btn or 8btn or 10btn generates a wrong sound and a fading of the touched sprite. However touching the 1btn makes it flashing, another sound is played, the Game1 Layer is deactivated and then made invisible, then the Game2 layer is shown and is activated. The outcome is then the banana minigame:
That is built according to the same design pattern, however the event sheet shows the difference, and namely it goes back to the Title
From this Layout we have learned:
- how to detect choices by clicking on sprites
- how to have more then one "games" within the same Layout (this could turn out useful if reusing elements, such as in this case the background and the Guide)