How do I run a loop at a slower rate?

0 favourites
  • 2 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I have this option in my game that causes intense calculations and I need to run several loops in order to achieve what I want. This option of course freezes the game and the CPU reaches the sky.

    So, I want to know if there is any way of making a loop that will run more slowly. I have tried using 'Each X seconds' and 'Wait' along with the loops, but that causes errors..

    Should I improvise and make my own loops? Like, increase a local variable (the loop index) each X seconds and do some stuff?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any loop event will complete in the same frame it is run.

    If you want to run a loop over time, use every x seconds (or every tick), and an incrementing counter to keep track of how many times to loop.

    For example,

    Every 0.1 seconds

    countervariable < x

    -> Do looped action

    -> Add one to countervariable

    You can combine this with smaller loops as well, to break up a larger loop into smaller ones in succession.

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