Save and Retrieve UIDs from array

Get help using Construct 2

Post » Sun Jan 27, 2013 4:13 am

I plan on having a few way-points aligned with a grid around my layout. I figured that when I create them at start-up, I would save their UIDs in a 2D array in order to reference them easliy.

I run a Loop to create the objects and save their UIDs to an array in position (1, loopIndex). Then, I try to "Pick Instance with UID". For the UID, I use array.at(1, loopIndex), the same position I saved the objects to.

What am I doing wrong?

Maybe a downloadable .capx will help.

Thanks for any help!
B
4
G
3
Posts: 21
Reputation: 942

Post » Sun Jan 27, 2013 1:50 pm

Hi, i think its because the for loop runs first and doesnt include the pick. The point at which you pick the UID the loop has finished.
B
44
S
15
G
9
Posts: 1,096
Reputation: 11,013

Post » Sun Jan 27, 2013 1:52 pm

B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Sun Jan 27, 2013 1:58 pm

Thank you!
I was able to do what I wanted by shoving a "Trigger Once While True" event after the "On Start Of Layout".

Can I have multiple "On Start Of Layout" events? Is one way better than the other?
B
4
G
3
Posts: 21
Reputation: 942

Post » Sun Jan 27, 2013 2:04 pm

Yeah you could have the object picking loop in it's own 'on start of layout' event. Putting 'trigger once while true' on it's own is basically the same as 'on start of layout' I think.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm and 27 guests