when a loop is done?

0 favourites
  • 11 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies. For use in game and custom works.
  • hi,

    when a loop is done? i create a random map by using the steps below. now i want to replace 2,3 created sprites AFTER the loop - e.g with pick random sprite1 instance

    -on start of layout

    --system: for "x"from to to int(sprite2.width / 16) - 1

    ---system: for "y" to int(sprite2.height / 16) - 1 System create Object "fam1" on layer 0 at 0,0

    fam1: set position to ((Sprite2.X - Sprite2.Width / 2) + (loopindex("x") * 16+ 7) , (Sprite2.y - Sprite2.Height / 2) + (loopindex("y") * 16 + 7)


  • Add a sub event (under start of layout, not under the loop) and use the system action: Pick random instance?

  • already tried that... nothing happened

    see screenshot attached.


  • move all the sub events over 1 and make 1 under

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • tried some other conditions - all are working fine except the pick instance.

    any idea?


  • trultz

    same result.... i think the problem is "pick a random instance"


  • found a workaround... at least for me it looks like a workaround....

    i've to add a action "wait 1 seconds" and then run the "pick a random instance" then it works good...

    cant understand why i need to wait 1 second..... do i need to increase the 1 second if the double for loop takes longer????


  • I think this might have to do with the way C2 strangely picks "Created" objects right away, but "Spawned" ones a tick later. Can you try replacing the Spawn action with System - Create object - earth1.x earth1.y and see if you can do without the wait? Also, you can try a Wait of 0.01 seconds or whatever, I think that might work.

  • Somebody

    thanks for your help. system - create object without a wait action does not work, however waiting for 0.01 seconds works perfect!

    strange, but now it works.


  • You might prefer a "wait 0", it will execute the remaining actions at the end of the event sheet, with no wait.

  • Seconded on the Wait 0.0. Matter of fact, when my picking goes wrong that is the first thing I add to see if it works.

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