Help using the WAIT command -- noob question

0 favourites
  • 9 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I am making a Gremlins game and during the bonus round it shows the mogwai's that you've saved one by one, left to right, with about a 1 second delay before the next one is presented.

    Although it works fine with no delay, if I put the delay in, the behavior becomes unpredictable and it does not work correctly.

    I do understand that this is not working because despite reading several tutorials and forum posts on the wait command, I cannot seem to get my head around it.

    Here are some screenshots:

    (everything in red is not in the game itself)

    <img src="" border="0" />

    Here is the code that I am using to do it, but take into account, it does not work correctly.

    <img src="" border="0" />

    Can anyone suggest a simple way to add a delay as each mogwai is shown?

  • Wait causes many people grief until they get it. Wait does NOT stop the game from progressing. What happens is that, to the side, in parallel, there is a wait and then any actions/sub-events immediately FOLLOWING the wait action are performed.

    Your code, as is, is going to continually loop in the WHILE event because of this, but the two MogweiNumber sub-events will occur after one second (with the Wait turned on again that is).

    Hopefully this is enough to let you rethink your wait code.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • All I really want it to do is, instead of putting the little mogwais in a line all at once, It will display them 1 at a time.

    Doesn't seem like it would be that tough, I just don't know how to do it.

  • I think if you add an Every 1 Second condition it will cause a wait in between. Not on computer so I can't confirm this though.

  • One possibility:

    <img src="" border="0" />

  • I would suggest making your own timer and not let the game progress unless the timer is at 0:

    timer.capx (r116)

  • EncryptedCow's method also works.

    <img src="" border="0" />

    There is a subtle difference though. This method only runs on every second since the game began. For one second you don't really notice anything, but if the delay was longer, say 10 seconds, the first run can take anywhere from 0 to 10 seconds to start.

    Note: You don't need/want the WHILE in your code.

  • <img src="" border="0" />

    I like this code , but what is that variable called 'dt'?

  • It's delta-time, read this tutorial for more info.

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