Make the player immortal for a short time

Get help using Construct 2

Post » Mon Jan 11, 2016 7:12 am

As example, while my player is flashing, thats for 1 sec, his health variable cant change. So when hes walking into a enemy, he should be immortal for 1 sec.
How can i check that? First step: while player is flashing and then? Is there something to set a variable to a value that cant be changed? Thanks!
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Mon Jan 11, 2016 7:26 am

1) create a variable boolean for damageImunity with default value false
2) while player is flashing set damageImunity to true
3) else set damageImunity to false
4) where the player gets damage add a condition compare 2 values player.damageImunity = false
B
7
Posts: 9
Reputation: 271

Post » Mon Jan 11, 2016 7:30 am

And the importance of functions is proven.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Mon Jan 11, 2016 7:42 am

First thank you wabsol :) But on step 4, I have to compare 2 values, but which one? Can you explain this step a bit more ? :P sorry ^^
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Mon Jan 11, 2016 7:47 am

Oh i got it! Had to invert the last step :) Thank you guys!
B
27
S
10
G
3
Posts: 76
Reputation: 3,068

Post » Mon Jan 11, 2016 8:32 am

no problem :) i like to help
B
7
Posts: 9
Reputation: 271

Post » Mon Jan 11, 2016 7:00 pm

You can simply add the action ignore collision for 1 second. I think this should work.

Set collision disable
wait 1 sec
Set collision enable
B
38
S
10
G
9
Posts: 212
Reputation: 6,995

Post » Tue Jan 12, 2016 6:59 am

Thats sounds also pretty nice, thanks @anty21ro :)
B
27
S
10
G
3
Posts: 76
Reputation: 3,068


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests