How do I make this for loop work?

0 favourites
  • 4 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Hello,

    another event activates the group asdf

    But this very simple loop doesnt do what I want lol. I want ever 0.5 seconds to spawn an object at x=0,100,200,300 and also increase the size by 50 everytime but it doesnt work. It's like the loopindex stays 0 all the time because it only creates 1 (or more objects and puts them all at the same spot).

    Ive dont stuff like this 1000 times already which is why I am so confused. Can someone help? thanks

  • So you really want

    local number blabla=1

    system repeat 10 times

    system wait 0.5 seconds

    system create object sprite_obstacle at (blabla*100, 1961)

    prite_obstacle set width to 50*blabla

    system add 1 to blabla

  • So you really want

    local number blabla=1

    system repeat 10 times

    > system wait 0.5 seconds

    > system create object sprite_obstacle at (blabla*100, 1961)

    >sprite_obstacle set width to 50*blabla

    > system add 1 to blabla

    Thank you but this doesnt work at all. It doesn't increase the width. It somehow works if I replace the wait system 0.5 seconds by wait system 0.5 * loopindex. But the width stays the same.

    /e: well it all works if I use a global variable instead of a local one..very weird

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not sure this is a good way of doing this. Would you be better off setting a repeating timer and having a counter of the number of times it has fired, then kill the timer when you have done 10 ? Like this ?

    http://www.studio2.org.uk/c2/Spawning.capx

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