; Var(51) - Simul TAG flag. 0 = Normal, 1 = Special Simul (with partner)

;---------------------------------------------------------------------------
; Entering the screen
[Statedef 4500]
type = A
movetype = A
physics = N
anim = 42	; <- You can use the standard running animation or put another one
sprpriority = 2
ctrl = 0
facep2 = 1

[State 0, screen] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0

[State 0, change]
type = changeanim
triggerall = partner, life > 0
trigger1 = !time
value = 4010

[State 0, pos]
type = PosSet
trigger1 = time = 0
x = -243*facing
y = -140

[State 0, vel]
type = VelSet
triggerall = anim = 42
trigger1 = AnimElem = 1
x = 10
y = -3.5

[State 0, vel]
type = velset
triggerall = anim = 4010
trigger1 = AnimElem = 1
x = 16;ceil(p2bodydist x * 0.095 * facing);14;ceil(p2bodydist x * 0.9)
y = 1.5;ceil(p2bodydist y * 0.095 * facing);2.5

[State 0, vel]
type = veladd
trigger1 = AnimElemtime(1) > 0
;trigger1 = (enemynear, statetype = A); || p2bodydist y = [-10, 10]
y = .5

[State 0, snd]
type = playsnd
triggerall = anim = 4010
trigger1 = AnimElem = 2
value = S60, 0
channel = 0

[State 0, snd]
type = playsnd
triggerall = anim = 4010
trigger1 = AnimElem = 2
value = S51, 0

[State 0, cheat] ; the character cannot be hit until he has fully entered on the stage
type = NotHitBy
triggerall = stateno = 4500
trigger1 = BackEdgeBodyDist <= 0
trigger2 = anim = 4010 && AnimElemtime(6) < 0
value = SCA
;time = 2

[State 0, cheat] ; if partner was KOed, appear being invincible
type = NotHitBy
triggerall = stateno = 4500
trigger1 = Partner, Life <= 0
value = SCA
;time = 6

[State 0, hit]
type = HitDef
triggerall = Anim = 4010
triggerall = (!var(4) && var(2) < 1) || numtarget(555)
trigger1 = AnimElem = 3
attr = A, NA
damage = 50
animtype = Diagup
;air.animtype = back
;fall.animtype = back
guardflag = MA
hitflag = MAF
priority = 4, Hit
pausetime = 13, 13
;sparkno = 0+(random%4)
;guard.sparkno = 40
;sparkxy = -10, -76
hitsound = S2, 5
guardsound = S6, 0
ground.type = Low
ground.slidetime = 17
ground.hittime = 17
ground.velocity = -5, -9
air.type = High
fall = 1
fall.recover = 1
fall.recovertime = 120
yaccel = .5
air.velocity = -5, -9
air.hittime = 120
air.recover = 0
Id = 555
ground.cornerpush.veloff = 0
air.cornerpush.veloff = 0
forcestand = 1
envshake.time = 9
fall.envshake.time = 0
fall.envshake.freq = 0.0
fall.envshake.ampl = 0
fall.envshake.phase = 0.0
sparkno = S-1 + 0 * (var(33) := 8012)
guard.sparkno = S-1 + 0 * (var(34) := 8000)
sparkxy = -10 + 0 * (var(35) := 60), var(36) := -50

[State 0, idle]
type = statetypeset
trigger1 = AnimElemtime(5) >= 0
movetype = I

;[State 0, vel]
;type = velset
;trigger1 = pos y >= 0 && vel y > 0
;x = 0
;y = 0

[State 0, end] ; cancel if:
type = ChangeState
;triggerall = backedgebodydist >= 0
trigger1 = pos y >= 0 && vel y > 0
value = 4052
ctrl = 1

[Statedef 4052] ; Define your own taunt here
type = S
movetype = I
physics = S
anim = 52
sprpriority = -2
velset = 0,0
ctrl = 0

[State 0, pos]
type = posset
trigger1 = !time
y = 0

[State 0, Dust]
type = explod
triggerall = anim = 52
trigger1 = !time
vel = 0, 0
anim = 10055
sprpriority = 0
postype = p1
pos = 0, 0
ownpal = 1
scale = 0.5, 0.5
pausemovetime = -1
supermovetime = -1

[State 0, playsnd]
type = playsnd
triggerall = anim = 52
trigger1 = AnimElemtime(1) = 0
value = S47, 0

[State 0, anim]
type = changeanim
triggerall = anim = 52
trigger1 = !Animtime
value = 195

[State 0, snd]
type = PlaySnd
triggerall = anim = 195
trigger1 = AnimElemTime(1) = 0
value = S195, 0+(random%2)
channel = 0

[State 0, cheat] ; the character cannot be hit since he is leaving
type = NotHitBy
trigger1 = stateno = 4052 && AnimElemtime(4) < 0
value = SCA

[State 0, end]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

; Leaving Taunt
;--------------

[Statedef 4510] ; Define your own taunt here
type = S
movetype = I
physics = S
anim = 195
sprpriority = -2
velset = 0,0
ctrl = 0

[State 0, snd]
type = PlaySnd
trigger1 = AnimElemTime(1) = 0
value = S195, 0+(random%2)
channel = 0

[State 0, cheat] ; the character cannot be hit since he is leaving
type = NotHitBy
trigger1 = stateno = 4510
value = SCA

[State 0, ghost] ; Prevents the camera from following the char
type = PlayerPush
trigger1 = 1
value = 0

[State 0, end]
type = ChangeState
trigger1 = AnimTime = 0
value = 4511


; Leave the stage
;----------------

[Statedef 4511]
type = S
movetype = I
physics = N
anim = 40	; <- Jump Start animation
sprpriority = -2
ctrl = 0

[State 0, anim]
type = ChangeAnim
trigger1 = Anim = 40 && AnimTime = 0 ; <- plays the jump back animation when the jump start animation is finished
value = 43

[State 0, state type]
type = StateTypeSet
trigger1 = Anim = 43 && AnimElem = 1
statetype = A

[State 0, vel]
type = VelSet
trigger1 = Anim = 43 && AnimElem = 1 ; <- jumping back animation
x = -12
y = -7.5

[State 0, cheat]
type = NotHitBy
trigger1 = stateno = 4511
value = SCA

[State 0, ghost]
type = PlayerPush
trigger1 = 1
value = 0

[State 0, screen]
type = ScreenBound
trigger1 = 1
value = 0

[State 0, wait]
type = ChangeState
trigger1 = backedgedist < -30
value = 4512


; Wait out of the screen
;-----------------------

[Statedef 4512]
type = A
movetype = I
physics = N
anim = 0
velset = 0,0
ctrl = 0

[State 0, cheat]
type = NotHitBy
trigger1 = stateno = 4512
value = SCA

[State 0, ghost]
type = PlayerPush
trigger1 = 1
value = 0

[State 0, screen] ; Prevents the camera from following the char
type = ScreenBound
trigger1 = 1
value = 0

[State 0, life] ; Gains life (optional)
type = LifeAdd
trigger1 = (gametime%10) = 0
value = 1

[State 0, turn] ; always face the same direction as partner
type = turn
trigger1 = facing != partner,facing

[State 0, pos] ; always stay behind and at the same distance of the char on the stage
type = posset
trigger1 = 1
x = (partner, pos x) - 1000*facing
y = -150

;---------------------------------------------------------------------------
; Jumping in
[Statedef 4520]
type = S
movetype = I
physics = N
anim = 42
sprpriority = 2
ctrl = 0

[State 0, pos]
type = PosSet
trigger1 = AnimElemtime(2) < 0
x = -243*Facing
y = 0

[State 0, vel]
type = VelSet
trigger1 = AnimElemtime(2) = 0
x = 4 ;.5
y = -8.75

[State 0, cheat]
type = NotHitBy
trigger1 = stateno = 4520
value = SCA

[State 0, bound]
type = ScreenBound
trigger1 = 1
value = 0

[State 0, vel]
type = Gravity
trigger1 = AnimElemtime(2) >= 0

[State 0, vel]
type = VelSet
triggerall = AnimElemtime(2) >= 0
trigger1 = pos y > 0 && Vel Y >= 0
x = 0
y = 0

[State 0, change]
type = ChangeState
triggerall = AnimElemtime(2) >= 0
trigger1 = Vel Y >= 0 && Pos y > 0
;trigger1 = Pos Y > 0
value = 4521

;---------------------------------------------------------------------------
; Landing
[Statedef 4521]
type = S
movetype = I
physics = N
anim = 47
sprpriority = 2
ctrl = 0

[State 0, pos]
type = PosSet
trigger1 = Time = 0
y = 0

[State 0, cheat]
type = NotHitBy
trigger1 = stateno = 4521
value = SCA
;time = 2

[State 0, end]
type = ChangeState
trigger1 = !AnimTime; >= 0
value = 0
ctrl = 1
