YesNoOk
avatar

P2Dist (Triggers) (Read 7644 times)

Started by Odb718, September 11, 2015, 09:56:39 am
Share this topic:
P2Dist (Triggers)
New #1  September 11, 2015, 09:56:39 am
  • *****
  • Shame on you!
    • USA
Returns the distance of P2 from P1, where P1 is the player, and P2 is his opponent.

Format:
P2Dist [component]
Arguments:
[component] X, Y
Return type:
float
Error conditions:
none
Details:
For comparing the Y-distance, P2Dist gives the difference in the heights of the players' Y-axes. A negative value means that 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. See also P2BodyDist.
 
Code:
trigger1 = P2Dist Y <= -12
  True if P2 is at least 12 pixels higher up than P1.

Code:
trigger1 = P2Dist X = -112
  True if P2's center is exactly 122 pixels behind P1's center.
vVv N00bSaibot & Muramasa RoofTop vVv
Last Edit: September 18, 2015, 02:55:36 pm by Just No Point