How do I access the object type inside a Family event?

0 favourites
  • 7 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I have a family of objects. I have an event that says "when a member of the family is clicked, do something". Is there a way to differenciate the specific object type that was clicked?

    Here's a basic example of what I mean:

    Family "Pokemons" contains the following objects: "Bulbasaur", "Charmander" and "Squirtle".

    On Mouse click on "Pokemon", do something. If the Pokemon is a charmander, do another thing. If it's a bulbasaur, do something else. And so on.

    (The text with emphasis is the part that I'm wondering how to do)

    So, again, my question is, in an event that was triggered by a family, how can I figure out which family member (which object type) is actually involved?

  • Is this what your looking for ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, I see what you did. You used a family variable. Interesting. (and thanks for your time creating that capx!)

    But that's kind of a "manual" solution. Do you know if there's a way to do it without a variable? Like, is it possible to check for object type in a condition?

    Something like "If Object-type is "box", do ..."

  • No there's not.

  • You can have the condition "Bulbasaur: Pick instance with UID Pokemon.UID" which is kind of like saying "if this Pokemon is a Bulbasaur".

  • Ah nice! Exactly what I was looking for. It's a weird workaround, but it works fine.

    Thanks, ramones!

  • I had to use the two mentioned solutions at the same time.

    Thnx a lot.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)