How do I set an event when health is at 20% of max health?

Get help using Construct 2

Post » Wed Jul 15, 2015 1:13 am

I have local variables set up for the player's health in my game. When it reaches 20% or less, I want the health bar icon to flash. Currently, I have it hardcoded for when the health is <= 5, it flashes. This works fine. However, when I try to do the following, it still flashes at 5:
Event Sheet:
On player ---> compare variable player.hp ---> when value = player.MaxHp*0.20

For some reason, it will not calculate the *0.20, any advice on why this may be?
B
3
Posts: 6
Reputation: 189

Post » Wed Jul 15, 2015 1:17 am

Try changing the = to <= so it doesn't need it to be exactly 20% and the event can trigger below 20% as well just in case the health goes from 23% to 17% or something like that.

How do you know it isn't calculating the *0.20?
B
11
S
2
G
1
Posts: 79
Reputation: 842

Post » Wed Jul 15, 2015 9:14 pm

thank you!
B
3
Posts: 6
Reputation: 189


Return to How do I....?

Who is online

Users browsing this forum: 25games, Baidu [Spider], brunopalermo, maranpis, oosyrag and 24 guests