0 Favourites

How do I get class type of object in family?

  • Hello,

    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

  • 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

    subevent

    • mouse is over objectA

    or

    • mouse is over objectB

    > actions

    else

    actions

  • 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.

    Example:

    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?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
135 14,299
melaniko's avatar
melaniko
Unread hot topic
85 81,070
grigrizljac's avatar
grigrizljac
Unread hot topic
99 10,149
karshinkoff's avatar
karshinkoff