0 Favourites

Making a loop while variable = 1

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

  • Construct 3

    Buy Construct 3

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

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

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