YesNoOk
avatar

P2BodyDist (Triggers) (Read 5244 times)

Started by Odb718, September 11, 2015, 09:50:55 am
Share this topic:
P2BodyDist (Triggers)
New #1  September 11, 2015, 09:50:55 am
  • *****
  • Shame on you!
    • USA

  • Online
Returns 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:
[component] X, Y
Return type:
float
Error conditions:
none
Details:
For comparing the Y-distance, P2BodyDist 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, 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.

Code:
trigger1 = P2BodyDist X < 30
  Triggers if the front of P2 is within 30 pixels of the front of P1.

vVv Ryuko718 Updated 10/31/22 vVv
Last Edit: September 18, 2015, 02:55:47 pm by Just No Point