Timer behavior bug...?

0 favourites
  • 6 posts
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • Faced with some strange behavior of the timer.

    I need to make a delayed animation with the wave effect ... i.e. when you click on any sprite, other sprites to the left and to the right of it will start a timer with time as on a screen.

    The array contains the UIDs of the sprites, ax variable of the sprite store the index in the array.

    When I click on sprite, I loop through all the sprites, first to the left and start the timer with a time that increases with each iteration of the loop, same to the right.

    The trick is that if you click, for example, on the 4th sprite, then the first 3 sprites on the left will react to it as expected, BUT the first 3 sprites on the right are not. The rest will also react normally.

    Now the fun part. If to do so:

    visually, everything works, but the data in the array is not updated...

    Am I doing something wrong or what?

    Demo project

    P.S. same behavior in C2 :/

    Tagged:

  • When I click your link I'm getting "access denied" error.

    Try adding "System For each Sprite" to the On timer event.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When I click your link I'm getting "access denied" error.

    Fixed

    Try adding "System For each Sprite" to the On timer event.

    Its "trigger" event, it cant be inside loop, only on top, but it makes no sense...

    Well, it worked, but i wonder why it doesnt without loop?

  • On timer event can be triggered for multiple object instances, if their timers expire at the same moment. When this happens, your action "Array set at Sprite.ax to 0" will only update one index in the array, unless you add "For each Sprite" loop.

  • Yes, in the case that multiple objects' timers go off at the same time, "On Timer" will only activate for one of them, unless you put a for each. Not sure why this is

  • Noah. Not for one of them, but for all of them. So you can do things like "Object destroy" without "For each" and it will work fine. But in some other situations you might need "For each" loop to process instances one by one.

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