Making a loop while variable = 1

Get help using Construct 2

Post » Sun Aug 20, 2017 2:48 pm

Hi, so right now I'm in the process of creating a loop in a different way.
So I have a start and stop button for this, right now whenever the player clicks start:

The global variable will go to 1
While the global variable is 1
Wait this amount of seconds
Add this amount to balance
Repeat

I'm having a hard time getting the repeat to work, because right now all it's doing is
Waiting the amount of seconds
Continuously Adding amount of balance without the wait after first time.
B
5
S
2
Posts: 5
Reputation: 435

Post » Sun Aug 20, 2017 3:18 pm

Hey Tyler,

Launch the game in 'Debug mode' and scroll down and find your variable. Is it behaving like you expect it to?

If you want the loop set up like that you should use something like

Variable =1
Every 'X' seconds - Add amount to balance


That will loop as long as the variable is 1.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Sun Aug 20, 2017 7:13 pm

GenkiGenga wrote:Hey Tyler,

Launch the game in 'Debug mode' and scroll down and find your variable. Is it behaving like you expect it to?

If you want the loop set up like that you should use something like

Variable =1
Every 'X' seconds - Add amount to balance


That will loop as long as the variable is 1.


There isn't an option for Every X Seconds.
I have it setup using

System > Status = 1 | System > Wait Seconds
System > Add 1 to balance
B
5
S
2
Posts: 5
Reputation: 435

Post » Mon Aug 21, 2017 5:51 am

It is there, I think you are looking for it through the actions (the left side of the event is for conditions, the right side for actions).

Conditions:

System > Compare variable
System > Every X seconds

Actions :

System > Add 1 to balance.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Mon Aug 21, 2017 12:08 pm

GenkiGenga wrote:It is there, I think you are looking for it through the actions (the left side of the event is for conditions, the right side for actions).

Conditions:

System > Compare variable
System > Every X seconds

Actions :

System > Add 1 to balance.


Oh my, I'm an idiot! Thank you. I wasn't even thinking about it like that way. Such a simple mistake that I would've never had to ask, if I just thought about it..
Thank you though!
B
5
S
2
Posts: 5
Reputation: 435


Return to How do I....?

Who is online

Users browsing this forum: maranpis, totoe and 24 guests