Time for action – detecting when Lives reaches zero
The game file to import and load for this session is 5961_06_05.stencyl
.
Create a new scene called
Game Over
— Select the Dashboard tab, select Scenes, and then select Click here to create a new Scene. Leave all the settings at their default configuration and click on OK.Close the tab for the newly created scene.
Open the Manage Player Collisions behavior and click on the Collides with Enemies event to display the event's instruction blocks.
Insert a new if block under the existing
print
block.Modify the if block to if Lives > 0.
Move the existing block, trigger event RestartLevel in behavior Health for Self into the if Lives > 0 block.
Insert an otherwise block below the if Lives > 0 block.
Insert a switch to Scene and Crossfade for 0 secs block inside the otherwise block.
Click on the Scene option in the new block, then click on Choose Scene and select the Game Over scene.
Change the secs textbox to
0
(zero).Ensure that our modified Collides...