Gives the distance of P2 from P1, where P1 is the player, and P2 is his opponent. P2BodyDist is useful in the CMD for cases where P1 has an attack that is different when performed close to P2.

Format: P2BodyDist [component]

Arguments:

Return type: float

Error conditions: none

Details:

For comparing the Y-distance, P2Dist and P2BodyDist work exactly the same. The value is negative if P2 is above P1. For comparing the X-distance, P2Dist gives the X-distance of P2's axis from P1's axis. A positive value indicates P2 is in front of P1.

For comparing the X-distance, P2BodyDist gives the X-distance of P2's front from P1's front. So, if the players are standing right next to each other, then P2BodyDist is 0. Remember that you can set the width of the player in "front.width", etc. under [Size] in the player variables.

Example:

trigger1 = P2BodyDist Y <= -12 ; True if P2 is at least -12 pixels higher up than P1.