How do I - Make an action last for a specific time?

Get help using Construct 2

Post » Wed Mar 18, 2015 5:05 pm

Hi Everyone - I am trying to figure out how to use a timer. I set a player's opacity to 50, disabling collisions for this condition, but I would only like it to last 5 seconds. I am trying to use the timer behavior, and set the timer accordingly, but I can't seem to figure it out. Is there a simpler way to make any given action last for a particular time?

Thanks!
B
5
Posts: 11
Reputation: 249

Post » Wed Mar 18, 2015 5:51 pm

When you set the opacity to 50, also set a timer for 5 seconds. create another condition to check for the timer going off. In this condition, reset the opacity.

Image
B
26
S
5
G
3
Posts: 22
Reputation: 4,539

Post » Wed Mar 18, 2015 9:26 pm

Sounds like you are trying to do something similar to what I did in my space shooter (in my signature area). When my player dies he is invulnerable during the respawn period for a few seconds.

I ended up using a variable for vulnerable (yes/no) and a set opacity 0 (I used set visibility but same thing really), respawn player (who is set invulnearble but invisible), Wait 3 seconds, set player to visible and then variable to vulnerable. In my damage event I simply check whether player is vulnerable before allowing damage.

You could do something similar just using opacity instead.
B
46
S
10
G
4
Posts: 554
Reputation: 5,951


Return to How do I....?

Who is online

Users browsing this forum: alajajm, Moot, R0J0hound and 8 guests