health bar question

allc1865allc1865 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

  • tatiangtatiang Posts: 11,949
    Accepted Answer

    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.

Answers

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

    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.

  • allc1865allc1865 Member, PRO Posts: 777

    @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!

  • allc1865allc1865 Member, PRO Posts: 777

    @tatiang , that worked! You're such a genius

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

    Glad I could help!

Sign In or Register to comment.