=================
Flying (VS Style)
=================
Created by Kuzu-bei

;---------------------------------------------------------------------------
Flying (VS Style) --  A special ability of movement in the air. Be sure to 
add in a velset with a Y value of 0, if not used.

Be sure to add this in the StateDef of most states. It will prevent the 
floating effect from going over to these states.

velset = 0,0
;---------------------------------------------------------------------------
;Begin Flight
[Statedef 9000]
type = A
movetype = I
physics = A
ctrl = 0
anim = ***
velset = 0,-* ; Value to go up

[State 9000, Fly]
type = ChangeState
trigger1 = AnimTime = 0
value = 9001 ; Next state
ctrl = 1

;---------------------------------------------------------------------------
;Flight
[Statedef 9001]
type = S
movetype = I
physics = N
ctrl = 0
anim = 9001

;Creates a guarding ability. 
[State 9001, Guard]
type = ChangeState
triggerall = P2MoveType = A
triggerall = P2BodyDist X <= 120
trigger1 = command = "holdback"
value = 130

;When no directional keys are pressed, the character stays in place.
[State 9001, Stop1]
type = VelSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = Var(1) = 0
trigger2 = Pos Y < -200 
x = 0
y = 0

;Animation of character when no directional keys are pressed. 
[State 9001, Stop2]
type = ChangeAnim
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = Anim != *** ; Flight animation (neutral)
value = *** ; Flight animation (neutral)

;Sets Var(1) to a value of 1, when the value is currently 2.
[State 9001, VarSet1]
type = VarSet
trigger1 = command != "holdfwd"
trigger1 = command != "holdback"
trigger1 = command != "holdup"
trigger1 = command != "holddown"
trigger1 = Var(1) != 2
trigger2 = Var(1) = 2
trigger2 = Vel Y >= 2.4
v = 1
value = 1

;Sets var(1) to a value of 2, when the value is currently 1.
[State 9001, VarSet2]
type = VarSet
triggerall = Var(1) = 1
trigger1 = Vel Y <= -2.4
trigger2 = P2BodyDist Y > 400
trigger2 = Vel Y < 0
v = 1
value = 2

;When Var(1) has a value of 1, the character will float up.
[State 9001, VelAdd1]
type = VelAdd
trigger1 = Var(1) = 1
y = -0.3

;When Var(1) has a value of 2, the character will float down.
[State 9001, VelAdd2]
type = VelAdd
trigger1 = Var(1) = 2
y = 0.3

;When any directional keys are pressed, the float effect stops.
[State 9001, VelSetY]
type = VelSet
triggerall = Var(1) != 0
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
trigger3 = command = "holdup"
trigger4 = command = "holddown"
y = 0

;When any directional keys are pressed, variables will be inactive.
[State 9001, VarSetEnd]
type = VarSet
trigger1 = command = "holdfwd"
trigger2 = command = "holdback"
trigger3 = command = "holdup"
trigger4 = command = "holddown"
v = 1
value = 0

;Border to fly.
[State 9001, UpBorder1]
type = PosSet
trigger1 = Pos Y < -200
y = -200

;etc...
[State 9001, UpBorder2a]
type = PosAdd
trigger1 = P2BodyDist Y > 201
trigger1 = Vel Y < 0
y = 1

;etc...
[State 9001, UpBorder2b]
type = VelSet
trigger1 = P2BodyDist Y > 200
trigger1 = Vel Y < 0
y = 0

;Dash forward.
[State 9001, RunFwd]
type = VelSet
trigger1 = Command = "FF"
trigger1 = Vel X < 9
x = 9

;Dash backwards.
[State 9001, RunBack]
type = VelSet
trigger1 = Command = "BB"
trigger1 = Vel X > -8.6
x = -8.6

;Dash downwards.
[State 9001, RunDown]
type = VelSet
trigger1 = Command = "DD"
trigger1 = Vel Y < 8.6
y = 8.6

;Dash upwards.
[State 9001, RunUp]
type = VelSet
trigger1 = Command = "UU"
trigger1 = Vel Y > -8.6
y = -8.6

;Moves the character downwards.
[State 9001, GoDown1]
type = VelAdd
trigger1 = command = "holddown"
y = 0.5

;etc...
[State 9001,GoDown2]
type = VelSet
trigger1 = command = "holddown"
trigger1 = Vel Y < 0 
y = 0

;Moves the character upwards.
[State 9001, GoUp1]
type = VelAdd
trigger1 = command = "holdup"
y = -0.4

;etc...
[State 9001,GoUp2]
type = VelSet
trigger1 = command = "holdup"
trigger1 = Vel Y > 0 
y = 0

;Animation of flying up.
[State 9001, GoUpAnim]
type = ChangeAnim
trigger1 = Anim != *** ; Fly up animation
trigger1 = command = "holdup"
trigger2 = Anim != *** ; Fly up animation
trigger2 = command = "holddown"
value = *** ; Fly up animation

;Moves the character backwards.
[State 9001, GoBack1]
type = VelAdd
trigger1 = command = "holdback"
x = -0.4

;etc...
[State 9001,GoBack2]
type = VelSet
trigger1 = command = "holdback"
trigger1 = Vel X > 0 
x = 0

;Animation of flying backwards.
[State 9001, GoBackAnim]
type = ChangeAnim
trigger1 = Anim != *** ; Fly back animation
trigger1 = command = "holdback"
value = 105

;Moves the character forward.
[State 9001, GoFwd1]
type = VelAdd
trigger1 = command = "holdfwd"
x = 0.5

;etc...
[State 9001,GoFwd2]
type = VelSet
trigger1 = command = "holdfwd"
trigger1 = Vel X < 0 
x = 0

;Animation of flying forward.
[State 9001, GoFwdAnim]
type = ChangeAnim
trigger1 = Anim != *** ; Fly forward animation
trigger1 = command = "holdfwd"
value = 100

;Character will turn around if the opponent is behind him/her.
[State 9001, Turn]
type = Turn
trigger1 = P2Dist X < 0

;Lands on the ground if character touches the ground.
[State 9001, Land1]
type = ChangeState
trigger1 = Pos Y >= 0
value = 52
ctrl = 1

;This ends the flying action if the command is used.
[State 9001, Land2]
type = ChangeState
trigger1 = command = (whatever)
value = 50
ctrl = 1

;Ends the flying action if the round is over.
[State 9001, RoundEnd]
type = ChangeState
trigger1 = Win
trigger2 = Lose
value = 50
