Reset Scene button in Pause Menu

SlightlyGrimSlightlyGrim Member Posts: 51
edited November -1 in Working with GS (Mac)
hi

I'm trying to make a reset scene button that appears in the pause menu, now the way I've done it now is had a invisible actor that tells the scene to reset every time reset = 1. Then all my button in my pause menu does is say change attribute reset to 1 and unpause game. the only problem I seem to find is once the scene is reset, my pause button doesn't work. Any idea of why or any better ways to do this?

cheers

Comments

  • CatGoneCrazyCatGoneCrazy Member, PRO Posts: 90
    Hi SlightlyGrim. I made a pause menu with Resume, Quit and Restart Scene options. Quit was easy as it just resets the entire game and resume is obviously a cinch. But Restart Scene was harder.

    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.

    It sounds long-winded, but it means the game resets the level and not just the pause screen. And it works for me!
  • CatGoneCrazyCatGoneCrazy Member, PRO Posts: 90
    It's possible you could just make the pause button actor reset the scene based on the global attribute, but I know I did it this way for a reason!
  • SlightlyGrimSlightlyGrim Member Posts: 51
    Yeah I did it with just one attribute but every time I reset the scene nothing seem to run, its kind of like the pause is still going but the menu gone and I have put an unpause behaviour in the pause menu but still no luck.

    I think I get it your way so I'll give it a go, cheers
Sign In or Register to comment.