How to make a "chain reaction" using a timer ?

Get help using Construct 2

Post » Wed May 15, 2013 12:07 pm

I have a boat that floats on 10 air containers. each container communicate with the one next to it, and the scenario is that if one container is flooded with water it takes 1 second for the next one do be flooded....and so on
I use opacity=100 if the container is flooded and opacity = 50 if is empty.
I can use opacity, different frame or animation to change the state of the container..but I want to use the same Object type.
In my example I want to wait 1 second before flooding the next container, but I only make it flood instantly.
Any ideas how to properly make a delay ?

capx
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Wed May 15, 2013 3:08 pm

floodanddrain.capx

You need to keep track of which one is active for each second.

I'm using lerp for flooding and just Every X seconds for the drain.
ImageImageImage
B
67
S
19
G
121
Posts: 3,196
Reputation: 72,879

Post » Wed May 15, 2013 7:32 pm

Thank you @blackhornet.
B
64
S
15
G
20
Posts: 469
Reputation: 16,027

Post » Wed May 15, 2013 8:38 pm

@blackhornet I tried to modify this for my game of pipes...but is becoming tooooo complicated and cannot figure out how to do it. The idea of the water coming through pipes is the same as for the boat...the difference is that the flooded container coming from the boats around .
It feels more natural to me the overlapping/collision condition, but Construct don't feel the same:)

[EDIT] I found a stupid simple solution. I put a collision polygon that when the containers are in normal position they do not collide, and when flipped they collide. I think is not the right way to do it...but it works...except the fact that I have to click inside polygon to register as a mouse click. But that don't bother me.


chain reaction v2Cipriux2013-05-15 22:29:51
B
64
S
15
G
20
Posts: 469
Reputation: 16,027


Return to How do I....?

Who is online

Users browsing this forum: MarkThomas and 0 guests