How do I identify specific instances within a family?

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi!

    I am working on a small prototype 1 versus 1 fighting game and I want to detect which character is getting damaged during combat.

    Each of the characters is in the same family I labeled as "Fighter", the reasoning was so I could create the combat logic once for the family instance and it would work the same regardless of which character was fighting. The issue I have come to is during the interaction between two instances of the "Fighter" family.

    Currently my logic asks if one character is in the ATTACKING state AND is overlapping another "Fighter". If this is true I want the other "Fighter" to go into their DAMAGED state.

    My question is, how do I identify the other "Fighter" that needs to be damaged? Because they are in the same "Fighter" family, I am not sure how to distinguish one from the other in the logic.

    I am hoping someone here may have come across this already and could share some insight on the correct solution.

    Thank you!

    Tagged:

  • Condition "Family is overlapping Family" should pick two instances. So inside of this event you can select one instance that is attacking, save its UID in a temp variable. And then pick the second instance with a different UID and change its state to 'damaged'.

    You should also decide what to do when both fighters are in attacking state, or none of them in the attacking state.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is perfect, just what I was looking for.

    Thank you very much!

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