How do I get class type of object in family?

Get help using Construct 2

Post » Wed Dec 09, 2015 5:23 pm

I have family FAM with three objects A, B, C.
I would like to make condition like:
Mouse | On Left Button Clicked on FAM | Do something.
But. I would like to do action ActA for click on objects A and B and action ActB for click on object C.

Is there something like:
If FAM instanceOf C | do ActB
else | do ActA

My question is about "object is instance of some class" not the other functions.

Thank you
Posts: 3
Reputation: 181

Post » Wed Dec 09, 2015 6:42 pm

Wouldn't it be much easier to just use objectA or objectB inside your event instead of the family?

You could ofcourse do:

on family clicked
- mouse is over objectA
- mouse is over objectB
> actions
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
Posts: 6,160
Reputation: 19,775

Post » Thu Dec 10, 2015 3:40 pm

Thank you,
it looks good.
but I have also situation, when I want to drag & drop some family objects to special area and after click OK I want to save all objects, which overlapping this area to Array.
Objects: A, B, C, B, C
Overlapping area: A, C, B, C
Save to Array: "A", "C", "B", "C"

I know I could save UID of objects into Array but I don't need the these objects for some time, so I would like to destroy them. Imagine you will get some goods and hide them to your pocket. When they are in pocket, they are not supposed to be visible and actually they don't have to exist. But some information about them has to exist for displaying them in future. These objects could be a lot of, so I think let them alive somewhere out of screen could make performance trouble.

Edit: Objects are only icons of some goods, which you can put to your pocket or so. If I will know in my pocket is "A", "B" I could create new these objects when I would need to display them. Is it possible?
Posts: 3
Reputation: 181

Post » Thu Dec 10, 2015 5:05 pm

I have some solution. If someone have better solution, I would like to know.

My family now has the family instance variable names Class of type Text, default Class variable of object A is "A", of object B is "B"...
I add to my Array value of variable of Family.Class and I get exactly what I described in post above.
Posts: 3
Reputation: 181

Return to How do I....?

Who is online

Users browsing this forum: Anudev Softwares, Google [Bot] and 6 guests