Why does this happen?

0 favourites
  • 7 posts
  • Hi all! It seemed like on the older version of construct 2 my health bar functioned normally. But ever since I updated to r132 I have had strange problems. For instance I set up an event like this:

    EventCondition1(<system> compare variable "Score" is greater than or = to 25)

    EventCondition2(<player> compare instance variable "life" is less than 5)

    EvnetCondition3(<system> trigger once while true)

    Action(<player> add 1 to "Life")

    So I have a max of 5 life, and with this event if I'm below 5 life and I hit 25 or greater score my life bar should refill by 1. That part works, but for some reason if I still have 5 life when I hit 25 or greater score I become invincible!!! According to my logic the event shouldn't activate if I have 5 health, but my health bar will not go down after this. Is my logic correct? Is this a bug? Any help or information on this would be great! Thanks in advance.<img src="smileys/smiley1.gif" border="0" align="middle" /> And this is just 1 of 3 strange things that have happened to my game recently.<img src="smileys/smiley19.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your logic is saying that you are invincible with a score over 24, because if you lose life it will just add it back.

  • Condition 2 says less than 5...thats 4 or less, so having 5 is not meeting the condition...

  • Hi alspal, thanks for the response. It would help me greatly if you could tell me how you would make an event similar to this but the right way please. Thanks again.

  • Hey Pixel. Well I set it to less than 5 because if I had five I don't want it going off and busting out of my Health bar frame.

  • Put trigger once on the top.

    Also, check your score checking and damage code. It might not be removing the score (25) so every time you go down 1 life, it goes back automatically since it triggers the second condition (It goes to 4, then since the score is 25, both conditions are true, it goes up to 5 immediately)

  • Thanks for the suggestion Thndr, but when I put trigger once on top nothing happens... You wouldn't happen to have an example on how to make events for a health bar that refills would you? Let me know, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)