Do While Not Loop

Get help using Construct 2

Post » Thu Oct 25, 2012 3:09 am

Hey there. I've been trying to make a loop to make something work, and I would like it to stop when X key is pressed.

So I was thinking it could work like:

Do While Not (key is down):
---stuff I want done goes here
endOfLoop

But so far I've been unsucessful on my attempts.

Here's a screenshot of the last one, maybe someone could give me a hand.

Thanks in advance.

B
12
S
1
Posts: 21
Reputation: 1,869

Post » Thu Oct 25, 2012 5:11 am

You should probably redo the events in terms of trigger-based rather then a while-not loop.

For example, you can set the text_start to be blinking at default as you did on your example, and only hide it when the key is pressed in another event.
B
7
Posts: 38
Reputation: 683

Post » Thu Oct 25, 2012 1:36 pm

[QUOTE=msv0001] You should probably redo the events in terms of trigger-based rather then a while-not loop.

For example, you can set the text_start to be blinking at default as you did on your example, and only hide it when the key is pressed in another event. [/QUOTE]

I don't want to hide it. The image is supposed to be fading out and then fading in (Not all the instructions are shown in the screen, since they-re just the same thing).

I need it to do it and not stop until a key is pressed.

I hope that clears it. Thanks again.
B
12
S
1
Posts: 21
Reputation: 1,869

Post » Thu Oct 25, 2012 5:37 pm

Your event does not make much sense, it says:

On start of layout: repeat forever while space is not down: <actions>

Since the status of whether space is down or not only updates at the end of a tick, this will most likely loop forever and hang the app.

Maybe you just need to use 'On key released'?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610


Return to How do I....?

Who is online

Users browsing this forum: Vegamon007 and 17 guests