Arrays in objects.

Get help using Construct 2

Post » Sun Dec 15, 2013 1:07 pm

I'd like to see this added as a feature, but until it is, what's the best way of having an array attached to my objects? Each of many objects in my game requires an array of 35 values - too many to have individual variables for each and I need to loop through them, so an array is the answer.

The only way I know of doing this, is to create an array each time I create the object, give the array a variable containing the UID of the object, and when I select the object, I can select the array by matching the variable with the UID of the object. Works fine, but seems a bit messy and I'm not sure if it'll be a bit heavy on resources.

Any better methods?
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sun Dec 15, 2013 1:50 pm

Add the array to a a container. That way it will only be affected by the one sprite it's in the container with and on creation of the sprite the array will be created automatically..

Manual entry on containersLittleStain2013-12-15 13:51:28
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Dec 15, 2013 2:47 pm

Ah yes, thanks, that's exactly the solution I was looking for :)
B
25
S
5
G
3
Posts: 446
Reputation: 5,633


Return to How do I....?

Who is online

Users browsing this forum: jatin1726 and 25 guests