How do I put a health bar into my game?

Get help using Construct 2

Post » Fri Sep 04, 2015 3:27 pm

My game is a platformer where the goal is to get to a door that appears and reappears. While trying to find it, there are enemies which fire at the player. I know how to do the whole projectile thing but I don't want my player to die unless he has little health left. Help?
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Fri Sep 04, 2015 3:34 pm

Give your Character Sprite a variable 'Health' and set its initial value to 100, or whatever you like

On 'Projectile' collision with 'Character Sprite' > Subtract X amount from 'Health' Variable

You can also Destroy the projectile in this event.

Hope it helps!
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 3:35 pm

Oh yeah and i forgot,

When 'Health' is equal or less than 0 > Destroy 'Character Sprite'
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Fri Sep 04, 2015 3:54 pm

Thanks Frostein, but how do I make a textbox display how much health I have?
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Fri Sep 04, 2015 4:54 pm

B
42
S
11
G
1
Posts: 264
Reputation: 3,299


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 45 guests