Every "300/Variable seconds" is somewhat buggy

0 favourites
  • 7 posts
From the Asset Store
characters sprites for creating a 2D action platformer or sidescroller game with cute, kawaii, fantasy theme
  • Hi guys,

    I am currently working on a platform game, where a player gains points when he is moving. The faster he moves, the more points he gains. (points = distance you traveled)

    Variable X defines the current Speed, so ""Every 300/X seconds -> add 1 to score"" works just fine. But when I fail/die, go back to menu and then go back to the level, the event simple wont work anymore.

    I can't explain myself why. I debuged everything and all the conditions are fine. X is not 0. Any advice? So many problems~~~ ty

  • Every X seconds is based on the game start time, not the layout start, so any restart won't work the way you want. Use a Timer instead for consistent results.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • why won't it work? I understand what you are saying but "Every 2 seconds" works aswell without any mistakes. 300/X is just another value ... I don't rlly understand

  • Every 2 seconds won't work any better, but it's harder to see the difference, since it's relatively quick, and is only off that first cycle.

  • hm okay. I dont quite get the logic but i am working with timers now. thank you tho

  • Keep in mind every x seconds starts at the beginning of the count, not the end.

    So it's, do foo, wait x seconds, do foo.

    Not, wait x seconds, do foo.

  • Did you divide by zero ? Making the previous 'every' wait forever?

    The 'every' accepts a new time after the previous one has expired, i think. Should be logic, because it skips ticks when its not true, not true means that it is not time yet to fire.

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