Wait bug or not ?

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Tutorial: Wait Tutorial

    This is given in the Tutorial:

    + Repeat 10 times

    -> System: wait loopindex seconds

    -> Text: append text "Time = " & time & newline

    This is what I make:

    + Repeat imagePointCount times (4, and yes 4)

    -> System: wait 2 seconds

    -> Spawn something on image.imagePointX(loopindex)

    -> Console.Log("ARRR")

    What it does:

    -> Second 1:

    --> nothing

    -> Second 2:

    --> Spawns something on the first imagePoint

    --> Logs 4 times "ARRR"

    -> Second 3:

    --> nothing

    -> Second 4:

    --> nothing

    ...

    For me it seems like Wait dont work.

  • It works, but as loops run ALL of their loops in single tick, all of your prints will wait for the exact same 2 seconds before appearing. So as tutorial demonstrated, add 'wait loopIndex seconds' instead of wait 4, and you'll get one text every second.

  • Coincidentally, I just added the system wait function in a loop index on Thursday, using the latest beta release v123.2. There's no problem with it for me, it works perfectly. It could be something else in your capx.

  • vee41 Forgot to tell you also tried it with "wait loopindex * 2 seconds" and also with "wait loopindex * seconds"

    AndyWatson could you make a example .capx ? Cause I made this in a new project... My Teammate also tried it, he has the same problem in a new clean project.

    here is a clean Example:

    Example

  • Most people misunderstand this aspect of it; 'wait' does *not* suspend the whole event sheet, because it would be useless if it did! (Imagine if your game paused every time you used a Wait action)

    So if you have something like this:

    + Repeat 10 times

    -> Wait 1 second

    -> Append "Tick" to text object

    then the loop completes immediately, but schedules ten "Append text" actions all after one second. After one second all ten of them run. Note the original example uses loopindex so it sets up a 0 second delay, then a 1 second delay, then a 2 second delay, etc. whereas you use a constant delay, meaning the entire loop is basically done instantly after a single delay.

    Edit: updated the tutorial to make this clearer.

  • Any plans to do a official wait behavior like the one David was working on in CC Ashley?

    I would add this would also be very nice to use to solve some of the bunching issues with pathfinder.

  • I can't remember exactly what it was David was working on, what did the behavior do?

  • It was called Timer behavior. It just had the ability to set up individual timers for instances.

    There's a third party plug or 2 that work similarly.

    The most useful part being able to have a trigger/condition for when the timer ends.

  • Isn't that basically what the Wait action does anyway? What's different or better about the behavior?

  • Well I would say the biggest difference is once you start the system wait you are committed to what ever actions are after it.

  • Not necessarily - you can have a subevent which tests some conditions, and the subevent won't run or test its conditions until after the 'Wait' resumes.

  • Yeah, but I would guess you would be dealing with changing variables back and forth all withing one event. That can get pretty complicated.

    The only other thing I could say is that picking with wait might be an issue, where the behavior should have none.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • newt - That sounds like a good idea. I've always longed for such a feature. I Did not like having to create an instance variable just for a custom timer for each feature I wanted. The wait command is not that usable for such a feature.

  • then the loop completes immediately, but schedules ten "Append text" actions all after one second. After one second all ten of them run. Note the original example uses loopindex so it sets up a 0 second delay, then a 1 second delay, then a 2 second delay, etc. whereas you use a constant delay, meaning the entire loop is basically done instantly after a single delay.

    Ashley, I know but this doesn?t work. I make "Wait Loopindex * 2" This should mean every 2 seconds 1 loop. But nope.

    + repeat 3 times

    -> Wait loopindex * 2

    -> Console.Log("Fire")

    -> Spawn Image on Imagepoint("loopindex")

    This does:

    Second 2: "Fire" + nothing

    Second 4: "Fire" + nothing

    Second 6: "Fire" + Spawn Image on Imagepoint("3")

  • Is there any different Tutorial or Example ?

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