Making a loop while variable = 1

0 favourites
  • 5 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • 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.

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)