use loop to fill screen with sprites. How to "wait"?

0 favourites
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • I am filling the screen with sprites, using loops. I am going to add random numbers from array later on, but for now I am just doing it normally...

    For Y = 0 to 15

    ---For X = 0 to 20 ---- Create object (blabla) at (loopindex("X")*32), (loopindex("Y")*32)

    This works.

    But If I tuck in System - Wait* It mucks up the whole thing. All the tiles are added at 640x480 pixels (=final value of the loops)

    So, I ask you how do I delay for every tile showing?

    I know this tutorial, but this doesn't help:

    https://www.scirra.com/tutorials/723/us ... t-in-loops

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • heh.. like in the capx I did in your other topic

    yeah loops occur in 1 tick, so you can't wait in a loop so easily. Perhaps like suggested in that tutorial. Why doesn't it help?

    edit : I guess it's complicated by 2 loops and also dynamic creation of objects..

  • I have ran into this as well - seems like the solution is to make your own loop - i.e. a variable you add to and then just do something like Variable < TargetSize do events, wait...

  • I have ran into this as well - seems like the solution is to make your own loop - i.e. a variable you add to and then just do something like Variable < TargetSize do events, wait...

    Yea probably the best idea. I think Timer behaviour might work too.

    edit: added 1 line to the other capx. try this. ok 2 lines

  • use time like this

  • codah, Somebody and Lordshiva1948 Thank you all for your replies. Thank you so much.

    The timer behavior seems to be the one to go! yay!

    But now I have a new puzzling issue.

    According to the loops X and Y in numbers, posted to Browser log (Console of browser) it shows the correct sequence: one per row.

    But the sprites are generating the whole row, and when that's complete it goes to next.

    Why do this happen?

    I will try to solve, but meanwhile, here's the capx.

    EDIT: corrected minor error i capx.

  • Sorry, I didn't need the physics updates in the beta versions so I stuck with 195 stable, so I can't open the capx. I might install to USB at some stage.

  • codah

    Ah, I understand! And if you want there's a "ugly" bypass:

    If you open the capx like it is zip (rename it to zip) and open one of the xml files (I forgot which) you can set it to the number you have in the content of that. Save, rename back to capx, and voila you can open it.

  • Yeah I know.. I was being lazy

    edit: I'm looking now, I'm trying to work out what you're doing with the stuff you've added

    I'm not sure what you mean by your comment "the sprite still puts all the X row and then go to next." That's how my sample did it too, except the numbers you're getting for the timer delays are not sequential, so they appear in the wrong order. I'm not sure the randomizing you're doing with tempArray is doing what you think it is doing? Maybe you could explain your intentions.

    BTW event 4 does nothing. You're just assigning all the values of TempArray back into TempArray again.

  • It is ok

  • codah

    Haha, yes welcome to my world.

    What my intention is to fill the screen randomly but not entirely random.

    For every ROW I want ONE tile to be added in a random position on that row.

    Repeat down the rows, and then start again from top, until the screen is filled.

    That was my intention.

    My idea of line 4 btw was to fill it with numbers (01234, 01234.... etc) but it is not needed because it is temp! so, removed.

  • Oh so the problem lies with the timer? Enable them wrong order? Hmm.

    I have to confess that I haven't wrapped my mind around the algorithm for the timer.

    EDIT: I figured it out, the algorithm was too convoluted. I borrowed the variable TileNumber (which is just a number that is counting up) and divided with 250, and it works now.

    whew.

  • codah Somebody

    Latest file, it is working now as it should. What do you think?

    Do you think this is device independent speed?

  • Tried this?

  • Seems to work - but in a final version would it show a "proper" level like this or is the effect just for randomly filling a screen with tiles?

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