YesNoOk
avatar

[Coding] Explod facing (Read 1328 times)

Started by Redash, May 29, 2018, 05:32:20 pm
Share this topic:
[Coding] Explod facing
#1  May 29, 2018, 05:32:20 pm
  • avatar
  • **
    • Singapore
Hi,

I wonder if anyone has any idea what is the correct Condition code to determine if a projectile lands in front or behind of enemy char?
My goal is the a "horizontal turn" (aka change of facing) of the Explod anim depending it lands behind or in front of the enemy

I tried the below but the facing is NOT always right when the chars switch facing/side...

;(IMPT: This is a Helper-Type Projectile state, Pos X refers to the position of the Helper-Type Projectile, not player character)
[State 1000, Explod]
type   = Explod
trigger1   = (MoveContact = 1) || (MoveHit = 1) || (MoveGuarded = 1)
trigger2   = (Pos Y >= -20)
anim   = 1000
;id   = 2300
pos   = 0,0
postype   = p1
facing   = Cond(Enemy,Pos X > Pos X, -1, 1) <= this is the part I have trouble with
;vfacing   = 1
bindtime   = 0
;vel   = 0,0
;accel   = 0,0
;random   = 0,0
removetime = -2
supermovetime = 0
pausemovetime = 0
scale   = 1,1
sprpriority = 3
;ontop   = 0
;under   = 0
shadow   = 0,0,0
ownpal   = 1
removeongethit = 1
ignorehitpause = 1
;trans   =
persistent = 0
;supermove =

I had also tried
facing = 1 && (Enemy,Pos X > Pos X)
(Enemy,Pos X > Pos X) * Cond((Pos X > Enemy, Pos X) && (Enemy, Pos X > Root, Pos X), -1, 1)
among many others...

But all not working properly when the characters are standing at certain distance or spots... Help please...
Last Edit: May 30, 2018, 07:10:04 pm by Redash
Re: [Coding] Explod facing
#2  May 29, 2018, 06:38:47 pm
  • ******
  • Hedgehog Whisperer
  • Red Bull addict
    • Spain
    • xgargoyle.mgbr.net
XGargoyle: Battle posing since 1979
http://xgargoyle.mgbr.net
http://www.pandorabots.com/pandora/talk?botid=e71c0d43fe35093a  <-- Please click that link
http://paypal.me/XGargoyle  <-- Donations welcome!
Re: [Coding] Explod facing
#3  May 30, 2018, 07:11:00 pm
  • avatar
  • **
    • Singapore
Thanks XGargoyle.

Its so straightforward with a P2Dist  < 0.

Appreciate the help. Saved me lots of agony.