0 Favourites

I've having trouble with the repeat/for

  • Hey guys,

    It's my first post here and I feel incredibly stupid for asking this but I really can't seem to figure out what's wrong. The issue is that when I use a for/repeat (for example to cycle between 0-2 or to repeat an event 3 times) it seems to repeat infinitely instead (even if I use a stop loop with the for which gets ignored).

    Here is the screenshot of the event which shows that I repeat the spawning of a single object for 3 times. It's the only piece of code in the whole project and the same effect applies if I replace it with repeat. After you'll see a screenshot showing that it's quite more than 3 once I press play..

    Anybody have any idea what I'm doing wrong? I feel really stupid as I'm pretty sure this is how it's supposed to work.

    Pic1.

    Pic2.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You're running the loop every frame, that's why it's endlessly generating sprites -- it's not the loop running endlessly. I'm guessing you want to create your objects when you start the game. In that case, add your loop as a subevent to an "On start of layout" event, which is an event under the system object.

  • Thanks for such a speedy reply! It didn't daunt to me to imagine the loop being started every frame. Somehow it made sense to me that if I used a loop that it would just do the loop and not make it happen every frame. It works perfectly now, thanks! I feel so dumb

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