How do I add Array to my instance ?

Get help using Construct 2

Post » Wed Dec 17, 2014 4:00 am

Hi

Currently we can only add Boolean, number and text as instance variable. How do I add array as instance variable ? I just want every instance to remember their own arrays of information(based on their own conditions in the game).

The total number of the instance is dynamic so I cant just create fixed number of arrays for each one of them.
B
75
S
22
G
14
Posts: 389
Reputation: 12,224

Post » Wed Dec 17, 2014 4:03 am

As you have a licence, you can use a Container.

Otherwise just have an 'id' number in both objects , then when picking them always use the id.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Dec 17, 2014 4:35 am

@codah

Thank you for your reply. I understand about container, but in my game I want to add multiple in game information in each instance (based on the instance locations, etc,etc,softcollision with what UID and so on) . Then in the event I want each instance to loop the array and then decide what will happen next. Each instance will also modify,update,delete and so on the array.

The closest I can see to do this in Construct 2 is store the information in a long formatted text. Then read them back using token and loop it. I was hoping not to do this way since this is going to really to make things too complex.

Basically I just want each instance to store information in local array so that It can loop it back and decides what to do next, after that it will or maybe clear and reset the array.
B
75
S
22
G
14
Posts: 389
Reputation: 12,224

Post » Wed Dec 17, 2014 4:47 am

hm actually Container is limiting except for simple requirements. I don't have time now sorry, but I'm wondering why you can't store some kind of index(es)/ID's/references in your objects and pick the appropriate arrays that way. I normally have a number of global arrays into which I index by some object 'ID'.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Dec 17, 2014 5:10 am

@codah

I see what you meant by using container now :) . Sadly Family object cant have container(it would be easier if it can though). Right now I have maybe about 20 unique enemies in the family, I just need to create 20 Arrays put each in container to different enemy and also assigned UID when it is created. This would be soo much easier.

Thanks!
B
75
S
22
G
14
Posts: 389
Reputation: 12,224

Post » Wed Dec 17, 2014 6:11 am

Ok good luck. Yes I'd like to have Family in Container functionality as well.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: tdcostas and 6 guests