Stop loop action

Just started using Construct 2? Post your questions here

Post » Fri Nov 21, 2014 6:26 am

Hey all

I have a doubt on the stop loop action. When called does it stop every loop that's running regardless of where it is. Say i had the stop loop as a sub event of a running loop. When called will it stop every loop in the event sheet?.

Thanks
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Fri Nov 21, 2014 8:11 am

Have you tried running a simple test? I mean create a mini project with two nested loops that do something visible. Then stop one of them and see what happens. I'd be interested in the result.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sat Nov 22, 2014 3:13 pm

There cannot be many loops running at the same time. If you use stop loop as a sub-event of the loop it will work as intended.

For instance run loop 15 times
L System|loopindex = 5 Stop loop
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Post » Sat Nov 22, 2014 3:41 pm

Hi @Katala are you saying that Construct 2 can't handle nested loops?
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sat Nov 22, 2014 3:47 pm

Last time I checked
"Stop loop
Stop a Repeat, For or For each loop currently running. These loops are system conditions. The rest of the event's actions and subevents will still complete, but the loop will not run any further after that."

So I would guess it stops, well, the current loop it is in.

So if you have

Repeat 10 times, for i from 0 to 10, stop loop

It would stop the for loop
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sat Nov 22, 2014 4:41 pm

@hundredfold
Sorry I wasn't very clear. It definitely can. I just meant that even then it only affects that particular loop where you but the stop loop action. I mean C2 runs loop to the end and continues to the next event etc... Question was about all loops on the sheet.
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Post » Sat Nov 22, 2014 5:33 pm

Here is a very simple example you can do.
Image
From clearly technical standpoint they don't run at the same time it is more like run Y times for X times.
If it would be a cube it would take much longer to run the whole thing.
B
34
S
9
G
3
Posts: 517
Reputation: 5,206

Post » Sat Nov 22, 2014 5:34 pm

Yes, that's pretty much how I understood it. Thanks.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest