health bar question
allc1865
Member, PRO Posts: 777
Hi everyone,
I created a health bar, and when it equals 0, gameover.
everything works except, when it's gameover, the health bar doesn't come back.
Any way to fix this?
thanks
Best Answer
-
tatiang Posts: 11,949
One problem is that you aren't resetting game.lives to 4 manually. A scene reset does not reset any game attribute values. So you have to use a change attribute statement right before the reset scene behavior in order to do that. I would change game.gameover to false right before you reset the scene.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
What do you mean by "doesn't come back"?
Also, we're not going to have any idea how to fix something we can't see. If you provide rules/screenshots, we'll have a better idea about how to resolve this.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
@tatiang, hi thanks for the reply.
so in this template below, when the actor collides with the enemy, change att. lives to lives-1.
the player has 4 lives.
when lives = 0 > gameover.
the problem I'm having so far is when lives = 0, it freezes.
what I'm trying to do is have it so when lives = 0, gameover. After gameover, the lives go back to 4 lives.
Here's the link: https://www.dropbox.com/s/uyal58zt8ty2qzh/health bar int.zip?dl=0
Thanks!
@tatiang , that worked! You're such a genius
Glad I could help!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User