;========================<Ground Bounce>=================================

[Statedef 244]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 5100

[state 0,0]
type = velset
trigger1 = time = 1
y = 10

[state 0,0]
type = veladd
trigger1 = time >= 0
y = 0.25

[state 0,0]
type = changestate
trigger1 = pos y >= 0
value = 243

;------------------------------------------------------------------------

[Statedef 243]
type    = A
movetype= H
physics = N
ctrl = 0
anim = 5110

[state 0,0]
type = changeanim
trigger1 = time = 5
value = 5070

[state 0,0]
type = velset
trigger1 = time = 0
x = 0
y = 0

[state 0,0]
type = posset
trigger1 = time = 0
y = 0

[state 0,0]
type = velset
trigger1 = time = 5
x = -1.5
y = -5.2

[state 0,0]
type = veladd
trigger1 = time >= 5
y = 0.25

[state 0,0]
type = selfstate
trigger1 = time >= 15
trigger1 = pos y >= 0
value = 5110

;========================<HIT WALL>======================================
;---Hit Pause---
[Statedef 1125]
type=A
movetype=H
physics=N
velset=0,0
[State 1125, anim]
type=changeanim
trigger1= 1
value=5012
[State 1125, end]
type=changestate
trigger1= hitshakeover
value=1126

;---Falling---
[Statedef 1126]
type=A
movetype=H
physics=N

[State 1126, vel]
type=hitvelset
trigger1= !time
x=1
y=1
[State 1126, grav]
type=veladd
trigger1= 1
y=gethitvar(yaccel)

[State 1126, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,1
[State 1126, push]
type=playerpush
trigger1= 1
value=0

[State 1126, anim]
type=changeanim
trigger1= !time
value=5030

[State 1126, bounce]
type=changestate
trigger1= backedgebodydist<=10 || frontedgebodydist<=10
value=1127
[State 1126, end]
type=selfstate
trigger1= vel y>0 && pos y>=0
value=5100


;---Hitting Wall---
[Statedef 1127]
type=A
movetype=H
physics=N

[State 1127, turn]
type=turn
trigger1= !time
trigger1= frontedgedist<backedgedist

[State 1127, pos]
type=posset
trigger1= 1
x=-160*facing
[State 1127, pos]
type=posfreeze
trigger1= 1
x=1
y=1

[State 1127, EnvShake]
type = EnvShake
trigger1 = !time
time =14
ampl = 6
ignorehitpause =1

[State 1127, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,1
[State 1127, push]
type=playerpush
trigger1= 1
value=1

[State 1127, anim]
type=changeanim
trigger1= 1
value=5000

[State 1127, end]
type=changestate
trigger1= time>=4
value=1128

;---Falling---
[Statedef 1128]
type=A
movetype=H
physics=N

[State 1128, turn]
type=turn
trigger1= !time

[State 1128, grav]
type=veladd
trigger1= 1
y=.5
[State 1128, vel]
type=velset
trigger1= !time
x=-0.5;-3.70
y=-9.5

[State 1128, anim]
type=changeanim
trigger1= !time
value=ifelse(selfanimexist(5051),5051,5030)
[State 1128, anim]
type=changeanim
trigger1= anim=5030 && !animtime
value=5050
[State 1128, Anim]
type=changeanim
trigger1= vel y>-3 && anim=5051 &&selfanimexist(5061)
value=5061
[State 1128, Anim]
type=changeanim
trigger1= vel y>-3 && anim=5051 &&!selfanimexist(5061)&&selfanimexist(5060)
value=5060
[State 1128, Anim]
type=changeanim
trigger1= vel y>-3 && anim=5051&&!selfanimexist(5060) &&!selfanimexist(5061)&&selfanimexist(5062)
value=5062
[State 1128, Anim]
type=changeanim2
trigger1= vel y>-3 && anim=5051&&!selfanimexist(5060) &&!selfanimexist(5061)&&!selfanimexist(5062)
value=5061

[State 1128, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,0
[State 1128, push]
type=playerpush
trigger1= 1
value=0

[State 1128, end]
type=selfstate
trigger1= vel y>0 && pos y>=0
value=5100

;------------------------------------------------------------------------
; P2 State
[Statedef 3306]
type    = S
movetype= H
physics = N
velset = 0,0

[State 0, PosSet]
type = PosSet
trigger1 = !time
y = 0

[State 1000, 0]
type = HitFallSet
trigger1 = time = 0
value = 0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
value = 5002

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
value = 3307 ;HITG_SLIDE

;------------------------------------------------------------------------
; HITG_SLIDE_High
[Statedef 3307]
type    = S
movetype= H
physics = S

[State 5001, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5007

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = SelfState
trigger1 = HitOver
value = 0
ctrl = 1

;------------------------------------------------------------------------
;Off screen Knockback
[Statedef 4020]
type    = A
movetype= H
physics = N
juggle = 1
ctrl = 0
velset=-15,-3
poweradd = 0
sprpriority = 1
facep2 = 1

[State 0, VA]
type = VelAdd
trigger1 =animelemtime(2)>=0
y =.45

[State 0, ChangeAnim2]
type = ChangeAnim2
trigger1 = !time
value = 4020  ;<=======custom animation

[State 0, ChangeState]
type = changeState
trigger1 = Pos Y >= 0 && Vel Y > 0
value = 4021
ctrl = 0
;------------------------------------------------------------------------
[Statedef 4021]
type    = L
movetype= H
physics = N
velset = 0,0
facep2=1

[State 4021, HitGround]
type = PosSet
trigger1 = 1
y = 0
[State 4021, 2]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14
[State 4021, EnvShake]
type = EnvShake
trigger1 =time=0
time=18
ampl=6
[State 4021, BounceGround]
type = ChangeAnim2
trigger1 = !Time
value = 4021

[State 4021, finish]
type = SelfState
trigger1 = time>=100
value = Ifelse(Alive,5120,5150)
;------------------------------------------------------------------------
;Wall-knockdown
[Statedef 4060]
type    = A
movetype= H
physics = N
velset = 0,0
sprpriority = 1

[State 4061, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,1
[State 4060, anim]
type=changeanim
trigger1= !time&&selfanimexist(5035)
value=5035
[State 4060, anim]
type=changeanim
trigger1= !time&&!selfanimexist(5035)&&selfanimexist(5030)
value=5030
[State 4060, anim]
type=changeanim2
trigger1= !time&&!selfanimexist(5035)&&!selfanimexist(5030)
value=4020
[State 4060, Turn]
type = Turn
trigger1 = Time = 0
trigger1 = P2Dist X < 0

[State 4060, VelSet]
type = VelSet
trigger1 = !time
x = -8
y = Ifelse(BackEdgeBodyDist<=35,-8,-4)

[State 4060, ChangeState]
type = ChangeState
triggerall = AnimElem = 1, > 0
trigger1 = BackEdgeBodyDist <= 5
trigger2 = Time >= 60
value = 4061
;------------------------------------------------------------------------
[Statedef 4061]
type    = A
movetype= H
physics = N
velset = 0,0
sprpriority = 1

[State 4061, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,1
[State 4061, push]
type=playerpush
trigger1= 1
value=1
[State 4061, pos]
type=posset
trigger1= 1
x=-160*facing
[State 4061, pos]
type=posfreeze
trigger1= 1
x=1
y=1

[State 4061, Anim]
type=changeanim
trigger1= !time&&selfanimexist(5051)
value=5051
[State 4061, Anim]
type=changeanim
trigger1= !time&&!selfanimexist(5051)&&selfanimexist(5050)
value=5050
[State 4060, anim]
type=changeanim2
trigger1= !time&&!selfanimexist(5051)&&!selfanimexist(5050)
value=4020
elem=3
[State 4061, EnvShake]
type = EnvShake
trigger1 = !Time
time = 14
ampl = 6

[State 4061, ChangeState]
type = ChangeState
trigger1=time=10
value = 4062
;------------------------------------------------------------------------
[Statedef 4062]
type    = A
movetype= H
physics = N
velset = 0,0
sprpriority = 1

[State 0, Turn]
type = Turn
trigger1 =!time
[State 4062, screen]
type=screenbound
trigger1= 1
value=1
movecamera=0,1
[State 4062, Anim]
type=changeanim
trigger1= !time&&selfanimexist(5061)
value=5061
[State 4062, Anim]
type=changeanim
trigger1= !time&&!selfanimexist(5061)&&selfanimexist(5062)
value=5062
[State 4062, Anim]
type=changeanim
trigger1= !time&&!selfanimexist(5061)&&!selfanimexist(5062)&&selfanimexist(5070)
value=5070
[State 4062, Anim]
type=changeanim
trigger1= !time&&!selfanimexist(5061)&&!selfanimexist(5062)&&!selfanimexist(5070)&&selfanimexist(5050)
value=5050
[State 4060, anim]
type=changeanim2
trigger1= !time&&!selfanimexist(5061)&&!selfanimexist(5062)&&!selfanimexist(5070)&&!selfanimexist(5050)
value=4020
elem=4
[State 4062, VelSet]
type = VelSet
trigger1 = AnimElem = 1
x = -2
y = -2

[State 4062, VelAdd]
type = VelAdd
Trigger1 = 1
y = .45

[State 4062, SelfState]
type = SelfState
trigger1 = Pos Y >= 0&&Vel Y > 0
value = 5100

;------------------------------------------------------------------------
;Custom-ceiling bounce
[Statedef 4065]
type    = A
movetype= H
physics = N
velset = 0,0
sprpriority = 1
facep2=1

[State 4065, anim2]
type=changeanim2
trigger1= !time
value=4065
[State 4065, VelSet]
type = VelSet
trigger1 =!time
x = -6
y = -10

[State 4065, ScreenBound]
type = ScreenBound
trigger1 =1
value = 1
movecamera = 1,0

[State 4060, ChangeState]
type = ChangeState
trigger1 = ceil(pos y<=-145)
trigger2 = Time=50
value = 4066







