How do I check what object is selected from a family?

0 favourites
  • 8 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Let's say enemy A and enemy B are inside Enemies Family. Then, if Enemies Family collides with the player, how do I know/get what kind of object hit the player? (because they have different damage for example)

    Tagged:

  • You set the damage variable at the Family level then it doesn't matter what collided with the player, you subtract Family.damage

  • lionz

    Thanks for the reply, but it seems like i don't ask my question well enough. what i'm actually asking is, how to get/select a certain object from a family?

    Allow me to give u the real screenshot of my problem :

  • Yeah the bottom bit, you pick the object itself if you are targeting the individual object.

  • I see, thanks. I thought there is a way that I somehow missed

  • Well technically when an object is created you could set a family variable to identify the object type but this is really just the same as picking the object. Family is there for when you want to pick everything at once, good luck!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Every objects have its own Unique ID. You can use this to specify an enemy out from its family.

    In your case, if you want to specify crawler or wanderer from its family.

    Add sub event for each enemy and add a condition like Crawler.Pick By UID(Enemies.UID) and Wanderer.Pick By UID(Enemies.UID)

  • Well technically when an object is created you could set a family variable to identify the object type but this is really just the same as picking the object.

    Oh damn you're right, idk why i haven't thought about this before. it solves a lot of my problems lol. Thanks, it really helps. lionz

    Now if i wanna select a certain member of a family, i can just like "if family name variable = something"

    yamside

    but i can't do that if i wanna select all the crawlers yeah? because UID is different in each instance of an object(?)

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