Repeat and While not working?

Discussion and feedback on Construct 2

Post » Wed Dec 28, 2016 11:37 pm

I tried While but the preview wouldn't even work. I did While and Variable = 1 and the preview didn't launch. Then I did On Start of Layout and Repeat 100000000 times (yes, that many) as the events then i had actions, but the preview wouldn't even launch.

Please help.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Wed Dec 28, 2016 11:40 pm

Anytime I use While or Repeat, the preview itself won't even launch.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Wed Dec 28, 2016 11:58 pm

While does not return until the condition goes false, so unless something in the loop changes the variable, the GUI will lockup. That's expected behaviour.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Thu Dec 29, 2016 4:23 am

How do you make a loop then? I thought While meant that while something was true it would keep happening. So at the end of the loop I set something to False, then at the beginning of the While Statement I set it to true?
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Thu Dec 29, 2016 4:33 am

We'd need to see more details. Remember, C2 is a giant While loop.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Thu Dec 29, 2016 7:42 pm

@Phoenixbowman
the event sheet automatically loops - every tick (60 times per second), so normally you don't need to set up another loop, unless you want something else to happen multiple times per tick. So, generally, things will always keep happening until a condition in the event becomes false... (without using Repeat or While)
It took my son a while to wrap his head around that when he was learning C2. The other thing he kept doing incorrectly was using Wait (thinking it would pause the event sheet). I see a lot of other people get confused with that too.
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Mon Jan 02, 2017 11:45 pm

Got it, I did Every X Seconds.
Last edited by Phoenixbowman on Tue Jan 03, 2017 12:14 am, edited 1 time in total.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Jan 03, 2017 12:14 am

FIXED! I did Every X seconds and it works! Every X seconds lets you customize how many seconds soemthing happens :)
B
20
S
7
G
3
Posts: 302
Reputation: 3,634


Return to Construct 2 General

Who is online

Users browsing this forum: tarek2 and 13 guests