How to recognize different instances of the same family?

0 favourites
  • 13 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I'm having problems when I wnat my enemies to hurt only one enemy at time . They already choose only one clone of a object type to attack, but they hurt one clone of each object type of the family.

    For example: When a "bad soldier" hits a "good soldiers" group it only hurt one of the soldier in the group, but at same time hurts a "good archer" that isn't in it's attack range just because the good archer make part of the same family that the good soldier.

    My code is:

    When "bad soldier" is overlapping "Good" family

    >System pick "Good" instance 0.

    >System pick "GoodSoldier" instance 0.

    -Make damage

    >System pick "GoodArcher" instance 0.

    -Make damage

    So how can I make the "bad soldier" hurt only the object type "good soldier" or "good archer" (the closest one) per time?

  • You don't want to pick the individual objects again. Any overlapping Good object is picked, so just "Make damage" on it.

  • But I want the bad soldier to hurt only one enemy at time, even when they're overlapped. For this he needs to choose on of the overlapped object types first and then choose one of the clones of this object type.

    The enemy soldier already can choose one of the overlapped clones but he can't choose just one of the overlapped object types. In a "good" group made of archers and soldiers, all overlapped, the enemy soldier hurts only one of the overlapped soldiers but he hurts at same time one of the overlapped archers. I want him to choose only archers or only soldiers and then one single of the choosed group.

  • You have that with Pick Good instance 0. That picks whichever the first one is, regardless of type.

  • yes, but when i make the action "Subtract 25 from vida" i can't especify to subtract only of the "instance 0" picked in the condition and then the damage go for all clones of the object type

  • Then you've got the Damage actions in the wrong place. The whole point of picking instance 0 is so that subsequent actions will only work on that instance. You need to post a CAPX, or at least an image of your events.

  • Here it is . Sorry for the language, i hope you can understand.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You didn't mention all of the other conditions required Given what I can see, change your four other "pick instance 0"s to "pick by UID = Mal.UID". This will pick the specific object by the base type, and only one of those should match and do anything.

  • Should I place all 4 subtract actions together?

    Like this?

  • No, that's not what I meant. In the previous image, replace "Pick Humtroglodita2 instance 0" with "Pick Humtroglodita2 by UID=Mal.UID". Same with the other three.

  • I thought it worked but don't worked.

    I've made this way but the arrow and the badsoldier are killing every instance that they collide.

  • I don't think I can help anymore without the CAPX.

  • I did it. Thank you so much for the attention and the help.

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