News:

MFG's Character of the Month: October 2026 Nominations

Main Menu

fly code

Started by Nexus Games, December 01, 2015, 12:21:46 PM

Previous topic - Next topic

Nexus Games

how can i add or what code can i use for a character to fly in the air and attack then fall?
this will help

Odb718

What youre asking has a million interpretations.
Are you wanting the character to do 1 special move where it flies around the screen and does an attack?
Are you wanting it to hover, do regular attacks, and then drop after time/command input?

Break down what you need help with first. 
vVv Gouken718 vVv SabreTooth718 vVv


Nexus Games

to hover and regular jump attack and drop after time like
magneto or ironman/warmachine in marvel vs. capcom 1

Noctis

#3
I don't know how those characters mentioned act, but for a simple jumping up, hover for a bit with the option to attack and then a fall after the attack shouldn't be that difficult.

When you jump you could trigger this by command or have it automatically happen, your choice, but just use a changestate in state 50 to a new state where you will be hovering.
State 55 or whatever.
The type should be A, physics should be N and movetype, I. In your commands section of Fighter Factory you'll have to put a trigger1 = stateno = 55 in order to be able to attack when in state 55 because if you put ctrl to 1 when in this state then you'll break the character and go into other states you don't want to go in.
Then just...velset, yo. First the initial velset with a y and x of 0 at !Time so that when you go into this state you don't glide off into the distance. And you're basically already hovering. Add fx and it'd look a lot more legit.

Because I liked the idea of how this would look I went ahead and coded it already. This is what it'd look like.
Mine looks different because I coded it to be 100% smooth af.
;---------------------------------------------------------------------------
; Hover
[StateDef 55]
type = A
moveType = I
physics = N
anim = 0
ctrl = 0

[state 55]
type = velset
trigger1 = time <= 30 && (vel y >= -2.5&&vel y <= 2.5)
y = 0
ignorehitpause = 1

[state 55]
type = velset
trigger1 = (vel x >= -.5&&vel x <= .5)
x = 0
ignorehitpause = 1

[state 55]
type = veladd
trigger1 = vel x
x = ifelse(vel x < 0,.175,-.175)
ignorehitpause = 1

[state 55]
type = veladd
trigger1 = time <= 30
trigger1 = vel y > 2.5||vel y < -2.5
y = ifelse(vel y < 0,.4,-.4)
ignorehitpause = 1

[state 55]
type = velset
trigger1 = time > 30 || !Vel y
y = -2*Sin((Time*0.2))
ignorehitpause = 1

[State 55]
type = changestate
trigger1 = Vel Y > 0 && Pos Y >= 0
value = 52

You could use vars to make it less likely to break, but that's too time consuming because I was just havin' some fun. Besides, unless your jump has a velocity higher than 12 at the start of this state, it will always make its way down to 0 in time.

Edit:
Because of the lack of vars, I could only do forward and back, but I added a little piece so that you can glide forward and back, too. Just put it above the rest of the veladds and velsets in state 55.
[state 55]
type = veladd
trigger1 = command = "holdfwd"
x = ifelse(vel x >= 3,0,.1)
ignorehitpause = 1

[state 55]
type = veladd
trigger1 = command = "holdback"
x = ifelse(vel x <= -3,0,-.1)
ignorehitpause = 1

(Youtube) (WIP) (Mediafire) (New Anime Shop) My Manga Reviews! Personal favorite Patreon! Check her out!

"There is nothing either good or bad, but thinking makes it so."