Timer behavior problem - Only works properly if layout is restarted?

0 favourites
  • 3 posts
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • Hello,

    I've got this game where traffic cars are supposed to spawn on the road every x seconds set by a timer.

    I'm using the timer behavior as such:

    What happens is, it will spawn a traffic car every 0 seconds since Global Variable 'TimerObjectAmount' starts as 0. Global Variable 'Level' starts as 1.

    However, if I restart the level by clicking the button (for example you ran out of time in the game), the traffic spawns just fine.

    It just won't set the TimerObject to the according TimerObjectAmount until the layout was restarted by the button.

    I tried many things, changing the order of events, destroy and recreate the TimerObject, nothing seems to work.

    If you proceed to the next level without the current level being restarted, it will change the TimerObject correctly, but it won't have the correct number gotten from TimerObjectAmount. In other words, it's always one step/level 'behind' unless that specific level was restarted.

    Example: You're one level 1. TimerObject is using the initial TimerObjectAmount=0 and ignores my event which should set it to 3. Layout is restarted ingame. TimerObject was correctly set to 3.

    Hope someone knows what's going on?

    Thanks!

  • Instead of two Level triggers have one with sub events for the global comparisons.

    On Timer

    ->g=1, do fo

    ->g=2, do fo 2

    Edit:

    Also On start of layout, starts before any ticks.

    Screen isn't really clear if that timer is resolved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hiya,

    Thanks for your reply.

    It had something to do with the On Start of Layout condition indeed.

    I replaced it with:

    Also put those Level triggers in subevents like you said!

    Now it's working fine.

    Thanks!

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