How do I run a loop at a slower rate?

Get help using Construct 2

Post » Sat Jul 15, 2017 4:19 pm

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?
My first project: Maze Island
B
20
S
8
G
1
Posts: 171
Reputation: 2,461

Post » Sat Jul 15, 2017 5:00 pm

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.
Mistakes were made.
B
51
S
25
G
107
Posts: 1,581
Reputation: 60,458


Return to How do I....?

Who is online

Users browsing this forum: Fenix18 and 62 guests