Okay here is the code i use.
I will explain codes line by line.
;----------------------------------------------------------------------------------
; go to fly mode
[statedef 999] ;< Statedef, this is the process to go in fly from standing.
type = A ;< Make sure you use A = Air as type
movetype = I
physics = N
juggle = 0
velset = 0,0
ctrl = 0
anim = 999 ;< Enter the anim you want
;go up (whether you are in ground or air before you went to this state, you go up)
[state 0, VelSet] ;< This is for make the character go up till the Anim ends
type = VelSet
trigger1 = 1
x = 0
y = -3
[state 0, ChangeState] ;< This Change state is to go to Fly Stand state after you are flying
type = ChangeState
trigger1 = animtime = 0
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly stance
[statedef 1000] ;< This is fly stance
type = A ;< Make sure you use A = Air as type
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
anim = 1000 ;< here enter the number of anim which you want as Fly idle
velset = 0,0
;limit for flying up
[state 0, PosSet] ;< This is to limit the character not to go too high, if you remove it then it won't be fair gameplay.
type = PosSet
trigger1 = pos y <= -180 ;< Limit -180 is ideal for it
y = -180
;fly stance float up
[state 0, VelSet]
type = VelSet
trigger1 = gametime%30 = [0,14] ;< This is to make the character float in AIR to make it look more real
x = 0
y = -1
;fly stance float down
[state 0, VelSet]
type = VelSet
trigger1 = gametime%30 = [15,29] ;< This is to make the character float in AIR to make it look more real
x = 0
y = 1
;turn
[state 0, Turn] ;< Simple Turn, When P2's distance is X <-10
type = Turn
trigger1 = P2dist X < -10
; fly dash forward
[state 0, ChangeState] ;< This is the command for fly dash forward.
type = ChangeState
trigger1 = command = "FF"
value = 1100
ctrl = 1
; fly dash backward
[state 0, ChangeState] ;< This is the command for fly dash backward.
type = ChangeState
trigger1 = command = "BB"
value = 1105
ctrl = 1
;fly forward ;< This is the command for fly forward.
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "holdfwd"
value = 1020
ctrl = 1
;fly backward ;< This is the command for fly backward.
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "holdback"
value = 1021
ctrl = 1
;fly up ;< This is the command for fly up
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "holdup"
value = 1040
ctrl = 1
;fly down ;< This is the command for fly down
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "holddown"
value = 1041
ctrl = 1
;go back to jump/fall state ;< This is the command for jump to ground if you Won in air, you know no one will like to have the win pose in AIR
[state 0, ChangeState]
type = ChangeState
trigger1 = Win = 1
value = 50
ctrl = 1
;go back to damage fall state ;< If you get hit then this will happen.
[state 0, ChangeState]
type = ChangeState
trigger1 = Life = 0
trigger2 = roundstate = 3
value = 5050
ctrl = 1
;go back to fly land state
[state 0, ChangeState] ;< This is to come down from Fly mode
type = ChangeState
trigger1 = pos y >= 0
value = 1047
ctrl = 1
;---------------------------------------------------------------------------
;fly fwd
[statedef 1020] ;< Fly walk fwd
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
;anim = 1020 ;< I have commented out the anim because i didn't had an Fly walk fwd so i use the Fly idle Anim for it
velset = 0,0
[state 0, Turn]; < Turn
type = Turn
trigger1 = P2dist X < -10
[state 0, VelSet] ;< VelSet or The speed to fly walk fwd
type = VelSet
trigger1 = 1
x = 4
y = 0
[state 0, ChangeState] ;< This change state is to go back to the fly idle state if you are not holding fwd
type = ChangeState
trigger1 = command != "holdfwd"
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly bkd
[statedef 1021] ;< fly Walk Back
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
;anim = 1021 ;< I have commented out the anim because i didn't had an Fly walk back so i use the Fly idle Anim for it
velset = 0,0
[state 0, Turn] ;< Turn
type = Turn
trigger1 = P2dist X < -10
[state 0, VelSet] ;< VelSet or The speed to fly walk back
type = VelSet
trigger1 = 1
x = -4
y = 0
[state 0, ChangeState] ;< This change state is to go back to the fly idle state if you are not holding back
type = ChangeState
trigger1 = command != "holdback"
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly up
[statedef 1040] ;< Fly Up
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
;anim = 1040
velset = 0,0
[state 0, Turn] ;< Turn
type = Turn
trigger1 = P2dist X < -10
[state 0, VelSet] ;< VelSet for the speed of Fly Up.
type = VelSet
trigger1 = pos y > -180 ;< I am using the pos trigger to stop to play the fly up anim when reaching the Limit. (Change the 180 if you have changed the limit.
x = 0
y = -4
;limit for flying up
[state 0, PosSet]
type = PosSet
trigger1 = pos y <= -180
y = -180
[state 0, ChangeState]
type = ChangeState
trigger1 = command != "holdup"
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly down
[statedef 1041] ; Fly down
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
;anim = 1041
velset = 0,0
[state 0, Turn]
type = Turn
trigger1 = P2dist X < -10
[state 0, VelSet] ; The speed of fly down
type = VelSet
trigger1 = pos y < 0
x = 0
y = 4
;go back to jump/fall state
[state 0, ChangeState] ; If you are landing with by pressing "down" then this will take it to the landing state
type = ChangeState
trigger1 = pos y >= 0
value = 1047
ctrl = 1
[state 0, ChangeState]
type = ChangeState
trigger1 = command != "holddown"
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly landing
[statedef 1047] ;< Airplane is landing
type = S
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
;anim = 1047 ;< I have commented this out because i didn't had an fly land
velset = 0,0
[state 0, PosSet] ;< You know PosSet
type = PosSet
trigger1 = pos y >= 0
y = 0
[state 0, ChangeState] ;< This is to take the character to the Jump Land state.
type = ChangeState
trigger1 = Animtime = 0
value = 52
ctrl = 1
;---------------------------------------------------------------------------
;fly dash forward
[statedef 1100] ; Fly Dash Fwd
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
anim = 1100 ;< Anim to the Fly dash Fwd
velset = 0,0
[state 0, VelSet] ;< Speed of Fly Dash Fwd
type = VelSet
trigger1 = time = 0
x = 5
[state 0, VelAdd]
type = VelAdd
trigger1 = 1
x = 0.1
[state 0, ChangeState] ;< To stop him
type = ChangeState
trigger1 = frontedgebodydist < 2
trigger2 = command != "holdfwd"
trigger3 = command = "BB"
value = 1000
ctrl = 1
;---------------------------------------------------------------------------
;fly dash backward
[statedef 1105] ; The fly dash back is same as the fly dash forward
type = A
movetype= I
physics = N
juggle = 0
poweradd= 0
ctrl = 0
anim = 1105
velset = 0,0
[state 0, VelSet]
type = VelSet
trigger1 = time = 0
x = -5 ;-0.2
[state 0, VelAdd]
type = VelAdd
trigger1 = 1
x = -0.1 ;-2
[state 0, ChangeState]
type = ChangeState
trigger1 = backedgebodydist < 2
trigger2 = command != "holdback"
trigger3 = command = "FF"
value = 1000
ctrl = 1
________________________________________________________________________________________________
;If you want to make the character fly even after getting hurt then make the 5000s state's type "A"
----------------------------------------------------------------------------------------------------------------------------------------------------------
EVERYTHING WHICH IS COMMENTED OUT IS IN RED COLOR.
I hope this helps, credit to sgn15 because he told me how to code fly.
TO make Fly Attacks copy the codes and make the type = A.
And do something like this in you CMD
;---------------------------------------------------------------------------
;Fly
[state -1, Fly] ;< This is the Fly code command
type = ChangeState
value = 999
trigger1 = command = "c"
trigger1 = statetype != C
trigger1 = ctrl
;flying Light Punch
[state 0, ChangeState] ;< There are fly attacks
type = ChangeState
trigger1 = command = "x"
value = 2000
ctrl = 1
;flying Strong Punch
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "y"
value = 2100
ctrl = 1
;flying Light Kick
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "a"
value = 2300
ctrl = 1
;flying Strong Punch
[state 0, ChangeState]
type = ChangeState
trigger1 = command = "b"
value = 2400
ctrl = 1
;Now an example of the CNS code of the fly attacks:
; Fly Light Punch ;< This is an example
[statedef 2000]
type = A
movetype= A
physics = S
juggle = 1
[state 2000, 2] ;< Now this is very important if you don't do this then you will be standing in air
type = ChangeState
trigger1 = AnimTime = 0
value = 1000 ;< In the value add the statedef number of the fly idle to make him fly after the attack finishes
ctrl = 1