Do loops wait until completion to spawn objects?

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I have a loop and a variable called var1. On the first run of the loop I want it to spawn a piece of a road and for each run after that it should put the next piece of road starting from where the last piece went down. What I've noticed is that I can't put this all in one loop. Here's a link to the capx, you can download that to look at the code. Maybe I'm just doing something wrong (in the code to make it simple I'm just trying to put a red dot on the ends of the road that were put down in the first part of the loop).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's no link to the capx to check, but I imagine that you can achieve what you want using something like:

    repeat 5 times| System spawn roadSprite at (X + roadSprite.Width*loopindex), Y

    ...where X and Y are your starting points.

  • Thank you so much, that did the trick. I was not using a local variable, instead I was referencing the sprites that were being created directly and that was not working. Now it's working perfectly

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