Issues with while loop

Get help using Construct 2

Post » Sat Jan 30, 2016 4:38 am

[http://]imgur.com/C6LoiLJ

i have events such that

--> Object B.x = randomx
--> Object B.y = randomy

While
Object B.x = randomx
Object B.y = randomy
Object B.boo = true
-->pick random value for randomx and randomy between maximum and minimum

-->create Object A
-->Object A.x = randomx
-->Object A.y = randomy

-----------------------------------

For each object A
Object B variable = object A variable
-->set location
-->Object B.boo = true

basically what I am trying to do is make a loop that keeps on choosing random values of randomx and randomy until it finds an instance of Object B with the same corresponding values of its variables x and y but its boo is set to false (or not occupied). Then create Object A and set its local variables corresponding to random x and y. So that all instances of Object A occupies an unique instance of Object B.

But it just does not work :p what ends up happening is that all instance of Object A have the same values of x and y and hence occupies the same instance of Object B

pre thanks :D
B
9
S
2
Posts: 16
Reputation: 570

Post » Sat Jan 30, 2016 10:44 am

You don't have to use while loop to random a value. At event 8 the system keep randomize the value, meanwhile event 9 does the same thing.
ImageImage
B
91
S
43
G
21
Posts: 739
Reputation: 20,448

Post » Sat Jan 30, 2016 11:55 am

Found a fix myself. Apparently some events just don't run when its a subevent of 'On start of Layout' so found a workaround. Thanks anyways though.
B
9
S
2
Posts: 16
Reputation: 570


Return to How do I....?

Who is online

Users browsing this forum: SoldjahBoy and 8 guests