Character Lives not working

Hello. I am trying to implement lives into my game but it appears the game program is glitching out.


I created a game integer that I named "Lives"

I created a rule where when the actor overlaps or collides with #hazards the attribute will change to game.lives-1

I created another rule for when the attribute game.lives = 0, it changes the scene to "Try Again"


It's weird because it works when the game integer is set to 1, but it stops working when it is set to a number higher than 1. Any advice?

Comments

  • Hideki MatsuiHideki Matsui JapanMember, PRO Posts: 82

    Maybe you need to fix the rule to game.live<=0. In your case, when the lives is less than 0, the rule doesn't work.

  • MikaylaPuentesMikaylaPuentes Member, PRO Posts: 6

    No, that didn't work. I'm still dealing with the same issues. Thanks for the help though :)

  • ArmellineArmelline Member, PRO Posts: 5,327

    Can you recreate the problem in a sample project file? There's a few things that might be happening here but it's hard to guess what.

  • MikaylaPuentesMikaylaPuentes Member, PRO Posts: 6

    Great, thank you! How do I do that? Do I just paste the URL of the copied project or are there more steps to take?

  • ArmellineArmelline Member, PRO Posts: 5,327

    That seems to have worked.

    Looking at the project file, it appears to behave as expected. If I set the lives to 5, colliding with a hazard removes one from the lives count. When the lives count reaches 0, the scene change is triggered. You have a separate rule that spawns a death animation on collision, and that animation has a rule that resets the game. if those are left turned on, the player never loses more than one life at a time as the moment they lose a life the game is reset and their live got back to full. Perhaps that's what's causing the confusion?

  • MikaylaPuentesMikaylaPuentes Member, PRO Posts: 6

    Thank you SO MUCH!!!! That WORKED!!!! You are a life saver

Sign In or Register to comment.