How can I reset Score on scene reload
Dell7730
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
-
tatiang Posts: 11,949
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
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
GOT It! I think, lol... I was hoping there was like an On Load command or something
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
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
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
in the rule that you use to reset the scene put in another attribute saying change attribute "score" to 0
I know, I put it there in case I want it delayed, so have you any idea as to why it's not working?
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.
How did you 'play again'?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
it's a simple touch game where if my mouse touch an actor, it's Game Over.
basically my play again rule is making it change back to the last scene, i'm already getting the mistake I made, lol...
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.
no worries glad to help