The game file to import and load for this session is 5961_07_15.stencyl
.
Clicked
, then modify the event so that it appears as shown in the following screenshot, remembering that the purple blocks are game attributes:Display Game Over Banner
.DisplayGameOverBanner
, and both of the set… instructions are updated:Health
and select the Show Angel event in the left-hand panel.We have utilized the reusable DisplayBanner
event to display a game over banner when the player loses all their lives.
In order to create our customized banner, we downloaded the two actors from StencylForge that contained the required images for the game over banner and the play option button, and we configured their physics settings so that they will always remain onscreen and cannot be paused. We also attached a custom event to Stencyl Book Play Button
, which, when clicked, resumes the game with the unpause game
block, resets the lives to 3
and level number to 1
, then switches to the Level1
scene so that the game restarts.
We then duplicated the DisplaySuccessBanner
event, renamed the duplicate to DisplayGameOverBanner
, and modified the duplicated event to specify Stencyl Book Game Over Banner
as Required Banner
, and Stencyl Book Play Button
as Required button
. We could have created the DisplayGameOverBanner
event manually block-by-block, but as we had an existing event that did a very similar job, it made sense to duplicate it and then modify its settings—after all, we know that the original DisplaySuccessBanner
event already worked perfectly!
The next step was to update the Show Angel
event to display the game over banner when the monkey runs out of lives. Previously, when the monkey ran out lives, we immediately switched to the Game Over
scene. But we no longer want to do that, so we deactivated the switch to Game Over…
block, and added an instruction to trigger the DisplayGameOverBanner
custom event in the Score Management
scene behavior.
Now, when our monkey runs out of lives, the DisplayGameOverBanner
event is triggered and it specifies the correct banner and option button, and then triggers the general-purpose DisplayBanner
event. The DisplayBanner
event displays the correct banner and option button; in this case, it's the Stencyl Book Game Over Banner
and Stencyl Book Play Button
. When the Play option button is clicked, the Lives
and Level
game attributes are reset, and the game switches to Level1
, so the player can start over from the beginning!
3.149.254.48