Character Lives not working
MikaylaPuentes
Member, PRO Posts: 6
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
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.
No, that didn't work. I'm still dealing with the same issues. Thanks for the help though :)
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.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
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?
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?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Thank you SO MUCH!!!! That WORKED!!!! You are a life saver