Why does this happen?

Discussion and feedback on Construct 2

Post » Tue Jun 04, 2013 2:25 am

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. And this is just 1 of 3 strange things that have happened to my game recently.
B
8
S
1
Posts: 42
Reputation: 1,159

Post » Tue Jun 04, 2013 2:56 am

Your logic is saying that you are invincible with a score over 24, because if you lose life it will just add it back.
B
140
S
71
G
17
Posts: 1,773
Reputation: 20,511

Post » Tue Jun 04, 2013 3:12 am

Condition 2 says less than 5...thats 4 or less, so having 5 is not meeting the condition...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Tue Jun 04, 2013 3:18 am

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.
B
8
S
1
Posts: 42
Reputation: 1,159

Post » Tue Jun 04, 2013 3:20 am

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.
B
8
S
1
Posts: 42
Reputation: 1,159

Post » Tue Jun 04, 2013 6:46 pm

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)
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Wed Jun 05, 2013 1:30 am

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!
B
8
S
1
Posts: 42
Reputation: 1,159


Return to Construct 2 General

Who is online

Users browsing this forum: zenox98 and 4 guests