;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0
[State 0, 1]
type = ChangeAnim
triggerall = life > (lifemax/4)
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0
[State 0, 1]
type = ChangeAnim
triggerall = life <= (lifemax/4)
trigger1 = Anim != 1 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 1
[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0
[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0
[State 0, 4] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050
;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type = C
physics = C
anim = 10
[State 10, 1]
type = VelMul
trigger1 = Time = 0
x = .75
[State 10, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 11
;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type = C
physics = C
anim = 11
sprpriority = 0
[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11
;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type = S
physics = S
anim = 12
[State 12, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type = S
physics = S
sprpriority = 0
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21
;---------------------------------------------------------------------------
; Walk Before Match
[Statedef 22]
type = S
physics = S
sprpriority = 0
[State 0]
type = varset
trigger1 = time = 1
var(50) = 0
[State 0]
type = posset
trigger1 = 1
y = 0
[State 0]
type = VelSet
trigger1 = Time = 0
y = 0
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)/1.5
[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)/1.5
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 22 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 22
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 23 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 23
[State 2, Ken]
type = ChangeAnim
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
trigger1 = Anim != 0
trigger1 = life > lifemax/4
value = 0
[State 0, ChangeAnim]
type = ChangeAnim
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
trigger1 = Anim != 1
trigger1 = life <= lifemax/4
value = 1
[State 20, 2]
type = VelSet
trigger1 = command != "holdback"
trigger1 = command != "holdfwd"
x = 0
[State var]
type = VarSet
trigger1 = roundstate != 2
fvar(9) = floor(pos x)
[State F]
type = posset
trigger1 = roundstate = 2
trigger1 = fvar(9) != 0
x = fvar(9)
[State F]
type = varset
trigger1 = roundstate = 2
fvar(9) = 0
[State F]
type = changestate
trigger1 = ctrl
value = ifelse((command = "holdfwd") || (command ="holdback"),22,0)
;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type = S
physics = S
sprpriority = 0
[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)
[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)
[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20
[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21
[State 40, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------