Running a loop

0 favourites
  • 5 posts
From the Asset Store
Full game Construct 2 and Construct 3 to post on Google Play
  • I have cards that some have certain values like +1, +2, etc. I'm trying to make a loop that will run a certain number of times depending on the value. Example player draws +2 and the loop will run the action 2 times. I've tried all the loops and they don't stop after the 2 run throughs. I think a "For" loop is what I'm looking for but I'm not sure how to add to the counter after each run through?

  • Create a variable to that will have the value of your most recent card. ie +2 would set that variable to 2

    Create a repeat variable amount of times condition with a draw card action

    This Idea:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks this will work more to my likening. One last question the program is running itself...how do I wait for a player action? Example its suppose to be on object touch then run action. Before I touch the object the new object is already spawned for value of the variable. Still very new to this.

  • Hard to tell without seeing the code for what you are talking about.

    You wait for a player action by putting it in the condition (left) side of an event.

    Card game I would imagine you want to add mouse or click objects, then use the condition On object clicked or On Tap Object.

  • Sorry I have 2 different ways that I'm spawning the cards.

    The original card is gone and the new one has spawned at location before I even click the card. Its reading value before I get a chance to interact with the card.

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