How do I set a layer invisible by time

  • I created a button that when I click it set a layer visible by certain time using a "wait" function. After the time was passed, the layer must set to invisble automaticaly. In the first time that I click in the button it works but, in second time, it doesn't work or, in the third time maybe, after that, it stays in random, sometimes the layer set visible and wait "x" seconds to disable, sometimes not

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • "Wait" shouldn't be used here.

    Try the Timer behavior. Add it to some object (background sprite or something).

    On click -> Start Timer "HideLayer" for 5 seconds (once)

    Sprite On Timer "HideLayer" -> Set layer invisible

    If player clicks several times, the timer will be restarted every time for 5 seconds.

    Another way to do it is to use system expression "time". Add a variable hideLayerTime, then add these events:

    On click -> Set hideLayerTime to (time+5)

    Compare variable hideLayerTime is Less than (time) -> Set layer invisible

    System Trigger once

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