Does System Wait 1.0 seconds really work

0 favourites
  • 6 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • I have something like

    Every tick & System(if varx > vary) -> Action -> System wait 1.0 secs

                                     -> add 1 to a variable

    What I expect is that every time var x > var y the system will wait 1 sec then add 1 to that variable

    but its like it jumps that adds 1 and then again after 1.0 wait it adds again.

    Anyone?

  • krish

    What about using Every X Seconds and set every 1 seconds ?

  • 'Wait' does *not* pause the rest of the events. Most people get caught out by this. In your case if the event is true every tick, it will schedule a new 'Wait' every tick, so after 1 second it adds to the variable every tick (~60 times a second).

    You probably want to use the 'Every X seconds' condition instead.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • well basically what I want to do is

    Change opacity of a layer from 0->100 (in increments of 1 every tick)

    wait 3 secs

    Then change it back from 100 ->0 (in decrements of 1 every tick)

    and keep doing so

    The other way I can think of is to have a variable like OpacityWaitTime.. set it to 3 every time opacity of level touches 0 or 100, substract 1 from variable every second.. and as it touches 0, trigger off the increment/decrements again.

    :(

    Any other cool/shorter suggestions :)

  • If you add dt to a value every second, it will increase by 1 every second.

    If you don't know how dt works, read the tutorial on 'delta time and framerate independence'.

    You'll need a boolean to decide when to decrease/increase.

    So your code will look something like this:

    boolean variable called 'increase'

    if increase = true:

    add dt to opacity

    if increase = false:

    subtract dt from opacity

    if opacity > or = 100, trigger once

    set increase to false

    if opacity < or = 0, trigger once

    set increase to true

  • sqiddster

    I fail to see where it waits 3 seconds though :(

    Probably too blind at the moment sorry :)

    I got the opacity changing every second already.. the problem was to make it wait 3 sec at end of reaching 0 or 100 and then go the other way.

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