Lives-1 results in infinitely decreasing number?

magicpegasus

  • Posts: 101
Hi, I'm having trouble with something I thought would be simple. I'm trying to lose a life. I have lives as a game attribute and a scene behavior that loses a life when it hears a message from the main actor. Instead of losing one life, however, the lives just continue to count down into the negatives. I've attached a picture, please help!
Thanks,
MP

rob1221

  • *
  • Posts: 9472
The behavior that sends the message "youfailed" may be executing too often.

Ceric

  • *
  • Posts: 610
Can you show the behavior that sends the "youfailed" message? That's where the problem would be.

magicpegasus

  • Posts: 101
I think I understand. The behavior block that sends "youfailed" is enclosed in "always". I've attached a picture. What is the best way to fix it?
Thanks you!

rob1221

  • *
  • Posts: 9472
Something like this should work.

magicpegasus

  • Posts: 101
I tried the above and got the same result. Is there a block on Forge for losing/gaining lives? I don't understand what I'm doing wrong. I attached the latest code and a swf of the game.
-MP

rob1221

  • *
  • Posts: 9472
The timed task will still run repeatedly.  Set "has died" to true just outside of the time block, not inside.  Compare to the image I posted earlier.

magicpegasus

  • Posts: 101
Thank you so much! That worked. I didn't understand that the "do after" blocks were continuous. It seems like they shouldn't be, but I guess after a certain point is continuous, and that point is finite. It would be cool if there was "do once after" or something.