Help using the WAIT command -- noob question

0 favourites
  • 9 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • 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="https://dl.dropbox.com/u/98438742/screenshot.png" border="0" />

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

    <img src="https://dl.dropbox.com/u/98438742/code.png" 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.

  • 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="http://bht.hostingsiteforfree.com/samples/WaitOne.jpg" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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="http://bht.hostingsiteforfree.com/samples/WaitOneB.jpg" 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="https://dl.dropbox.com/u/98438742/WaitLoop.png" 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)