0 Favourites

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

  • 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

  • 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.

  • Thank you blackhornet.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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. <img src="smileys/smiley10.gif" border="0" align="middle">

    chain reaction v2

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)