How do I make a character invincible after being damaged?

Get help using Construct 2

Post » Tue Sep 01, 2015 7:01 pm

Hi, this has been bugging me for the last hour or so and I cannot find an answer to it. How do I make a character invincible after being damaged? I have a kind of knock back effect but it still leaves the player in harms way.

Thanks in advance.
B
7
S
1
Posts: 29
Reputation: 519

Post » Tue Sep 01, 2015 7:33 pm

Set Global Variable: Invincible = 0

After collision with enemy, set Invincible = 1
Wait 3 seconds (or how many second you wish for your player to be invincible)
Set Invincible = 0

If invincible = 1 then do not make dmg to player (you need to get this into the part of the code where player takes dmg)

--or--

If you have the part where: player collides with enemy event, add another event: Invincible =0
So it would be: if player collides with enemy and invincible =0 -----> player takes damage



Or you could use true/false instead of 1/0.
Brick by brick, stone by stone.
B
56
S
25
G
18
Posts: 273
Reputation: 13,363

Post » Tue Sep 01, 2015 8:36 pm

Does this help?

Image
B
56
S
15
G
13
Posts: 826
Reputation: 17,665

Post » Tue Sep 01, 2015 9:26 pm

I think so, just about to try it out. Still very new to the construct 2 so fingers crossed I do it correctly.

JUBBLY!

It worked a treat, thanks very much guys.
B
7
S
1
Posts: 29
Reputation: 519


Return to How do I....?

Who is online

Users browsing this forum: Jackriduk, takamoto and 38 guests