Restart button
QuantumGames94
Member Posts: 13
Hi i am having trouble to make my restart button in my pause screen reset the level and lives, i have tried to do it but it seems to reset the level but the lives dont reset and I cant figure out how to do it any ideas on how to get my reset button in my pause screen to reset the lives????
Best Answer
-
JohnPapiomitis Posts: 6,256when the restart button is pressed use the change attribute behavior to change the attributes back to there starting values
Answers
as 3 is the amount of lives to start off with and it doesnt work as i am doing it wrong by putting 3 in there what should be where 3 is???
First I set up a global boolean attribute called ResetScene.
Then an actor called 'Restart Scene' that displays the text in the pause menu and give that its own boolean attribute 'ReallyRestart'. This has a rule that when actor receives event touch is RELEASED, it changes the actor's own boolean attribute 'ReallyRestart' from false to true.
Next, a new rule that when self.ReallyRestart is true, change image to 'really restart' (This means the player gets a second chance to decide whether or not they want to reset the scene).
Third rule: When self.ReallyRestart is true AND Actor receives event Touch is Pressed, Change Attribute game.ResetScene to True. Also add 'Unpause Game' to this rule's list. You might also wish to include some kind of score rest behaviour here so that people can't keep pausing and restarting the scene to falsely inflate their score.
Now all you need is another actor in the scene itself (I used my existing Pause button) with its own boolean attribute called 'ResetLevel'. Then create a rule that says when game.ResetScene is true, change attribute self.ResetLevel to true, and also change attribute game.ResetScene to false.
Finally, one more rule for the pause button that says When attribute Self.ResetLevel is true, reset this scene.