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

Get help using Construct 2

Post » Mon Feb 09, 2015 8:15 am

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
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Mon Feb 09, 2015 8:20 am

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..
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Feb 09, 2015 8:31 am

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...
B
19
S
6
G
7
Posts: 1,101
Reputation: 6,146

Post » Mon Feb 09, 2015 8:37 am

Somebody wrote: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: @helena.. added 1 line to the other capx. try this. ok 2 lines
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Feb 09, 2015 8:59 am

use time like this
You do not have the required permissions to view the files attached to this post.
B
256
S
39
G
15
Posts: 1,983
Reputation: 41,036

Post » Tue Feb 10, 2015 3:43 am

@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.
You do not have the required permissions to view the files attached to this post.
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Tue Feb 10, 2015 5:00 am

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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Feb 10, 2015 5:27 am

@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.
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Post » Tue Feb 10, 2015 6:47 am

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 :D
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.
Last edited by codah on Tue Feb 10, 2015 7:20 am, edited 5 times in total.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Feb 10, 2015 7:01 am

It is ok :)
B
58
S
18
G
13
Posts: 447
Reputation: 10,740

Next

Return to How do I....?

Who is online

Users browsing this forum: Pickernut and 23 guests