Timer not working?

0 favourites
  • 5 posts
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • I'm not really sure what the problem is with my code but it seems like there might be something wrong with the timer.

    <img src="http://puu.sh/2NQIj.png" border="0" />

    The problem is that they only seem to pick the first option. It never actually randomizes. I set it to jump and they only jump and if I set it to move right they only move right.

    What I want them to do is switch between the 4 behaviors every 2 seconds while Holding is true. Maybe I don't understand how "every x seconds" works but it seems to just be setting them all to the same thing and not doing anything every second.

  • Random doesn't produce whole numbers, so you need to round it off somehow. I suggest you use floor(random(4)).

    Heh, "the random issue" has come up so often lately.

  • round(random(0,3))

  • yonda

    Actually I think round(random(0,3)) is wrong

    random(0,3) will give you numbers from 0 to almost 3

    so you'll get this repartition:


    if your round that you'll get

    to 0  |   to 1    |    to 2   | to 3    

    So the rounding will introduce a bias toward 1 and 2 and reduce the chance to get 0 or 3.

    floor(random(4)), on the other hand, works because you get this:

        to 0   |    to 1   |    to 2   |    to 3

    Hope that makes sense (:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh my...I'm surprised I forgot about that. Thank you guys.

    And thanks a lot Yann for that tip.

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