restart of a scene
milan.dhont1
Member Posts: 3
in Help Wanted
hello,
i'm working the last days on a easy runner and its going oke so far.
found out that my restart button doesn't restart my whole game only the back ground and the player not his health and the score stay the same.
ask if you need to know what rules(and othere things) i have set
thanks for reading hope you can help me fast
Comments
When a scene restarts you need to manually reset your attributes (score, health, etc). You can place change attribute behaviors at the top of the logic stack in an actor and place it on your scene. When the scene is restarted, these behaviors will fire and your attributes can be reset.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Yes, we would need to know how you are restarting (what rules you are using). My guess is that you are using a Reset Scene or Change Scene behavior. Those behaviors only reset scene and actor (self.____) attributes, but not game attributes. For game attributes, you need to reset them manually by doing a series of Change Attribute behaviors.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
how do you reset a attributes like my health
set :game.health to: game.health +3
or somthing else
Change attribute. Game.health to 3
Or whatever number you want.
chanch attribute
game.health to 3
nothing happens btw i replicate my health does that make a difrenc ??
alsp
chanch attribute
game.score to 0
it doesn't get reset just stay the same
Well if it replicates then no it would not stay the same.
But if you change attribute score to 0. It will change it to zero. But other code. You have is changing it or preventing it from changing.