Fire bullet rate, diferent in devices

0 favourites
  • 4 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hi!!

    I need the fire rate is some in all devices, but if the device is slower (mobile), the bullet rate is diferente:

    is correct my configuration?


  • Hi !

    Don't use a "every x seconds" trigger condition for this ; if the actual framerate is slower, or not a multiple, of your time, it's not guaranteed to run at regular intervals. It's not a flaw in the "every x seconds" block, it's just bad logic.

    Use a timer you update every frame with dt to make sure events like that happen at a fixed frequency.

    E.g in pseudo logic :

    every tick >

    timer -= dt

    while (timer <= 0.0)



    timer += interval


    (this version ensures that if the frequency of the event is much higher than the actual framerate, the logic can run multiple times every frame ; this may or may not be desirable depending on the case ; change the "while" to an "if" depending on the requirement)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks!

    Is correct this example?

  • Yep, much better !

    Though you might want to change the "set timer to 0.2" to "add 0.2 to timer" ; otherwise you might be accumulating a small error every time it is time for fire a bullet, meaning the overall shooting rate will differ slightly depending on device performance.

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