How do I set spawning points with while?

Get help using Construct 2

Post » Fri Jan 02, 2015 3:53 am

Hello everyone!,

I've trying to randomly spawn some objects with the "while" command in a 4x4 arrangement, and everything goes great until I have to change the "Y" position.

Ideally, it will look like this:

ej1.jpg


But I'm ending up with this (been trying with only 5 objects atm):

ej2.jpg


Sometimes I get only one object in the 1st row, and four on the second, etc.

This is my event page:

ej4.jpg


My logic is the following:
When i>3 (meaning that 4 cards have been laid)
Create object at x,(new Y position, because it is a new row!)

I've been smashing my head against the keyboard for days because of this, any help is greatly appreciated!
You do not have the required permissions to view the files attached to this post.
B
25
S
8
Posts: 81
Reputation: 1,691

Post » Fri Jan 02, 2015 4:36 am

What if you have all the positions "hard coded". So, if the number is 3 or lower, they ll spawn at x=[0,120,240] y=[0] and if its bigger they will spwan the first line as before and then you add another "Y".
B
8
Posts: 26
Reputation: 348

Post » Fri Jan 02, 2015 4:08 pm

Cosme wrote:What if you have all the positions "hard coded". So, if the number is 3 or lower, they ll spawn at x=[0,120,240] y=[0] and if its bigger they will spwan the first line as before and then you add another "Y".


Isn't that what I have at "4" on the event page?
B
25
S
8
Posts: 81
Reputation: 1,691


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests