How can I reset Score on scene reload

Dell7730Dell7730 Member, PRO Posts: 388

So I played the game, made 395 points and the game ended moving to the Game Over scene, when I played again, it shows my last score and added more when I played. Any thoughts?

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer

    I was wanting to know what rules and behaviors you used to 'play again'. Are you just double-clicking on the scene thumbnail? Are you clicking the back button and then the Preview button?

    What is the rule condition for changing game.score back to 0? Usually, it would be something like (on a "Play Again" actor):

    When Touch is Pressed
         change attribute game.score to 0
         Reset Scene [or Change Scene]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Game attributes do not reset when you use a Reset Scene behavior. You'll need to change them back to 0 or their original value before resetting the scene.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Dell7730Dell7730 Member, PRO Posts: 388
    edited March 2015

    @tatiang said:
    Game attributes do not reset when you use a Reset Scene behavior. You'll need to change them back to 0 or their original value before resetting the scene.

    GOT It! I think, lol... I was hoping there was like an On Load command or something

  • Dell7730Dell7730 Member, PRO Posts: 388

    I made a timed change attribute of score to 0, still not working properly, what I am doing wrong?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @dellagarpo said:
    I made a timed change attribute of score to 0, still not working properly, what I am doing wrong?

    What is a 'timed change attribute'? Do you mean you placed a Change Attribute behavior inside of a timer? What is the full name of the attribute you tried to change? In which actor of which scene did you do this? Can you explain further or post a screenshot of your rules (you'll need to upload the screenshot to a file-sharing service before embedding/posting it here)?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Dell7730Dell7730 Member, PRO Posts: 388
    edited March 2015

    @tatiang said:

    Yes! I placed a Change Attribute behavior inside a timer. I wanted to have the score reset every time I change scene.

    Here's the link to screenshot goo.gl/ugpYkk

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    If you put something inside of an After 0 seconds timer, it runs immediately. It's the same as having no timer at all.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • deej011deej011 Member Posts: 159
    edited March 2015

    in the rule that you use to reset the scene put in another attribute saying change attribute "score" to 0

  • Dell7730Dell7730 Member, PRO Posts: 388

    @tatiang said:
    If you put something inside of an After 0 seconds timer, it runs immediately. It's the same as having no timer at all.

    I know, I put it there in case I want it delayed, so have you any idea as to why it's not working?

  • Dell7730Dell7730 Member, PRO Posts: 388

    @deej011 said:
    in the rule that you use to reset the scene put in another attribute saying change attribute "score" to 0

    I haven't made any scene reset actually, just moved it from scene to scene, maybe there's the problem, i'll try your suggestion and let you know immediately, thanks.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    when I played again, it shows my last score and added more when I played

    How did you 'play again'?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Dell7730Dell7730 Member, PRO Posts: 388

    @tatiang said:

    it's a simple touch game where if my mouse touch an actor, it's Game Over.

  • Dell7730Dell7730 Member, PRO Posts: 388

    basically my play again rule is making it change back to the last scene, i'm already getting the mistake I made, lol...

  • Dell7730Dell7730 Member, PRO Posts: 388

    I got it!!!!!!! Thank You!!!!

    Just learned that the game play scene should be on top of the Scene Layers so when a button to reset game, it resets it to that scene. I also included the Change Attribute for Score to 0 and it all works GREAT! Awesome Sauce!

    You guys are awesome, this makes me get closer to finishing my very first game ever.

  • deej011deej011 Member Posts: 159

    no worries glad to help

Sign In or Register to comment.