How do I store an instance in a variable?

Get help using Construct 2

Post » Sun Jul 27, 2014 7:06 am

In my game a work with many sprites and it would really help if I can save a sprite instance in a variable. I haven't found any solution to this.

/dag
B
4
S
1
Posts: 8
Reputation: 286

Post » Sun Jul 27, 2014 2:01 pm

You may need a better explanation of what you want to do.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Sun Jul 27, 2014 6:40 pm

As a professional developer am I used to store objects, not only strings and numbers, in a variable. Maybe I am thinking wrong what can be done in Construct?

I know of course about the different Pick events you can do. I use them rather often. I also use Rex Instance Group (which is great).

What I want to do is to compare from a big group of Sprites different things and see if they match. I know that it probably can be done in different way, but I really like to be able to store an instance of a sprite and then be able to get all properties for that sprite.

/dag
B
4
S
1
Posts: 8
Reputation: 286

Post » Sun Jul 27, 2014 7:33 pm

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 » Mon Jul 28, 2014 6:33 am

No, not the UID, this is a property of an instance. (But it is good to identify an instance.) I want the instance itself.
B
4
S
1
Posts: 8
Reputation: 286

Post » Mon Jul 28, 2014 6:35 am

Sorry guys. Maybe I am not thinking the right "construct 2 way". Thats why I ask.
B
4
S
1
Posts: 8
Reputation: 286

Post » Mon Jul 28, 2014 6:59 am

You cannot store an instance of an object (e.g. sprites) as with traditional OO languages (like have an array of them or something)... I believe there are third party plugins like 'instance bank' or something but I'm not sure if they do what you want. Usually the UID is stored, which can then be used to 'pick' the instance. But it's not the same thing.

Bottom line is no, you're not thinking the C2 way yet :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Jul 28, 2014 7:03 am

Thanks, then I know. I have to do this differently.
/dag
B
4
S
1
Posts: 8
Reputation: 286

Post » Mon Jul 28, 2014 7:37 am

B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Mon Jul 28, 2014 10:56 am

Thanks
I will check it out.

/dag
B
4
S
1
Posts: 8
Reputation: 286

Next

Return to How do I....?

Who is online

Users browsing this forum: varr, Yahoo [Bot] and 3 guests