How do I apply a list of values to enemies damage?

0 favourites
From the Asset Store
This sound pack features 117 game sounds : Axe,Punch Swing & Hit & Damage. This is a perfect collection for your game.
  • This works, but when there are multiple instances from the same family, construct only takes reference of the x value of the enemy I first put down in the layout (rather than the closest one), so if enemy 2 is like 500 pixels +X (right) of enemy 1, the collision still thinks you get hit from the right, no matter where enemy 2 is, even if he is to the left of the player (-x).

    You reference the enemy overlapping the player so it should only pick that enemy, however your logic then goes on to use global variable and no longer reference any enemies, so I don't know how you would know if it was picking other enemies. How are you recording that information?

  • Yes it should, but that enemy is a "family" composed by several enemies so I am telling it when you collide with any enemy of that family. If this logic would not work, then why does it work on the first drawn instance of it, should it not work like on all instances? Instead it always chooses to pick the x references of the first enemy, not the second or the third.

    The global variables mentioned in that image have nothing to do with the enemies, they are used to keep the player behaviour in check.

    The question I have been trying to ask is exactly the one you are asking.

    How do I tell it to first of all, only take in consideration the x of the closest enemy, not of the first enemy drawn on the layout.

    This:

    How do I tell it "the instance of the enemy hitting" or "the closest enemey hitting"?

    The second one, regarding damage, can wait, I want to solve this one first.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It does do that, that's why I'm asking for the reasoning that it is not doing that. When you say player overlapping with family, it only picks the one you are overlapping. When you also say in the same condition player x greater than family.x it picks that same instance of family that you are overlapping to do the x comparison.

  • The first question it asks is "is it overlapping?" right?

    The second is "is the player to the left or the right of the enemy"

    If I remove the "is it overlapping" the condition would constantly trigger becasue you are always either on the right or left of the enemy.

    So what you are saying is that it should already pick the nearest enemy, but is not working for some reason, right?

  • The condition is saying, if player is overlapping enemy and if player's X is greater than that enemy's x, i.e. enemy is on the left of the player, then do something. Should only detect the x for comparison of the enemy that is overlapping the player.

  • Oh ok, I was not aware of that, how would I make that happen?

  • Poor phrasing, I'm saying the condition does do that. I don't see a problem.

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