reseting game

allc1865allc1865 Member, PRO Posts: 777
Hi. I want to create a "retry" button in my pause menu. So every time you go to pause the game, you have "continue", "main menu", and also "reset", but every time you click the reset button, it resets the current scene. How can I get it to reset the game, instead of the current "pause menu" scene.
Any help would be great! Thanks.

Best Answer

  • -Timo--Timo- Posts: 2,313
    Accepted Answer
    also place this behavior above that change game.reset to false and delay the reset scene with a timer?

    after 0.01 seconds (check run to completion)
    reset scene

    and else post an image of your rule. maybe you did something wrong ;)

Answers

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    There's a behaviour for Reset Scene, and one for Reset Game. You may still want to add a bit of code to go to a particular scene once Reset Game has been called.
  • allc1865allc1865 Member, PRO Posts: 777
    @KevinCross, hi. That's what I had - Reset Scene, but that resets the current scene, which is my pause menu. I want it to reset the game at the last created checkpoint... Reset Game, if I recall, resets your whole game.
  • -Timo--Timo- Member Posts: 2,313
    first make a boolean attribute (lets say we call it game.reset)
    in the pause scene inside the reset button place the behaviors
    change attribute game.reset to true
    unpause game.

    inside the scene (level or something) place an actor with the behaviors

    rule
    if game.reset is true
    change game.reset to false
    reset scene.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    Oh right, you asked how do you reset the game and that you was using Reset Scene which was only erm... resetting the scene.

    If you don't want to use the standard reset behaviours you will need to go with a similar approach to what @timolapre1998 says. Have an attribute to say if the game needs resetting, and if it's true, add in all of the change attributes you need to reset scores, lives and whatnots, and then change to another scene.
  • allc1865allc1865 Member, PRO Posts: 777
    @timolapre1998, that works, thanks! But one problem is that I have a score, and so I'm collecting coins...I hit "retry", and it resets, but my score doesn't reset. It stays at 50, or however many coins I've collected.
    Any way to fix this?
  • -Timo--Timo- Member Posts: 2,313
    edited October 2013
    @KevinCross just mentioned how to fix that.

    also in the actor that has

    rule
    if game.reset is true
    change game.reset to false
    reset scene.

    also place a change attribute scores to 0 (make sure its above the reset scene behavior)
  • allc1865allc1865 Member, PRO Posts: 777
    Thanks, that's good advice.

    I did, change attribute > game.Score to 0, and placed it above my Reset Scene...
    It didn't work.
  • allc1865allc1865 Member, PRO Posts: 777
    Ooops. I posted the image of my reset in the wrong discussion. Sorry. Here's my rules. These are placed in my actor. image
  • -Timo--Timo- Member Posts: 2,313
    thats what I said ;) glad you fixed it. can you accept the answers?
  • allc1865allc1865 Member, PRO Posts: 777
    Yes, I still have a problem with it; the score won't reset along with my game.
  • allc1865allc1865 Member, PRO Posts: 777
    No, the score won't reset. When I said, "it works", I'm sorry, I meant the image showed up.
  • -Timo--Timo- Member Posts: 2,313
    Put the change attribute score to 0 above in the rule. If this doesnt work then put the change game.game reset in a timer
    After 0.01 seconds run to completion
    Change game.game reset to false
    Hope this helps
Sign In or Register to comment.