How do I get class type of object in family?

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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

  • Try Construct 3

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

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

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