Creating Fireballs

Fireballs: the first popular special move in fighting games (you can say that the Dragon Punch was the other one...). After Ryu and Ken first had it in Street Fighter 1, every Street Fighter game, heck , every GAME that came after had a character that had Fireballs.

Because Ryu is the quintessential projectile thrower in the fighting game world, we will use him to learn how to program fireballs in MUGEN.

Example: Ryu throwing a Fireball (Ryu by Mugenite)

Ryu throwing a Fireball at Garou:MOTW's Gato

Let's start ,as always, by looking at Ryu's CMD file:

CMD

;----------------------------------------------------------------------- ;Fireball_X [State -1] type = ChangeState value = 1000

triggerall = command = "fireball_x" ;-------

triggerall = numproj = 0

trigger1 = statetype = S

trigger1 = ctrl = 1

trigger2 = stateno = 200 ;Stand_x

trigger2 = movecontact = 1

trigger3 = stateno = 300 ;Stand_z

trigger3 = movecontact = 1

trigger4 = stateno = 500 ;Crouch_b

trigger4 = movecontact = 1

trigger6 = stateno = 210 ;stand_b

trigger6 = movecontact = 1

trigger7 = stateno = 400 ;crouch_a

trigger7 = movecontact = 1

trigger8 = stateno = 450 ;crouch_z

trigger8 = movecontact = 1

trigger9 = stateno = 430 ;crouch_x

trigger9 = movecontact = 1

There is only one line of importance in the above code, the rest of the lines handle how to 2 in 1 (or cancel) to this Fireball from other moves ( more on 2 in 1's here) and perform the usual checkings, but this is the important part:

triggerall = numproj = 0

In the above line we use the numproj trigger to check if the player has any active fireball. We use this to avoid letting the player throw more than one fireball at a time. That's it , we are done with the CMD file. Let's see how we program the projectile in the CNS file:

CNS

Now it's time to look at how we program the move itself. State 1000 contains all the code for this Fireball, so we'll take a look at it :

;--------------------------- ;FIREBALL_X [Statedef 1000] type = S movetype= A

physics = S

poweradd= 100

ctrl = 0

anim = 1000

velset = 0

In the definition part of the state (Statedef) we say that this is a standing move (type=s), this move is an attack (movetype=a), and will give 100 units of super bar to the player when he executes it (poweradd=100).

It is also stated above that the fireball will use animation number 1000. Please note that this animation is the animation of the character doing the fireball , and IT'S NOT the animation of the fireball itself.

Ryu's Animation no. 1000 : Throwing a Fireball

[State 1000, 3] type = PlaySnd trigger1 = Time = 2 value = 0, 3

This just plays the sound of the move, you know, that ULTRA familiar "Hadoken!" : )

[State 1000, 4] type = Projectile trigger1 = AnimElem = 4 projanim = 1005 ;Action id 1005 is Shinobu's fireball animation projhitanim = 1006 ;Action id when fireball hits

offset = 70, -53 ;Creation offset from player (x,y)

velocity = 3.5, 0 ;Speed fireball moves (x,y) (optional)

; HitDef part of projectile info

attr = S, SP

damage = 72,4

getpower = 60

givepower = 40

guardflag = MA

pausetime = 0,12

sparkno = 0,7

sparkxy = 0, 0

hitsound = 5,4

guardsound = 6,0

ground.type = High

ground.slidetime = 15

ground.hittime = 20

ground.velocity = -8

airguard.velocity = -3.5,-2.75

air.velocity = -2.5,-5.5

air.juggle = 3

air.fall = 1

This is the important part, so we will look at it carefully and dividing it into pieces:

1)

[State 1000, 4]

type = Projectile

trigger1 = AnimElem = 4

First we use the Projectile controller to tell the engine that we are programming a fireball move, (type=Projectile), and tell it that the Fireball is gonna be created in the fourth frame of the character's animation (trigger1 = AnimElem = 4).

Frame no 4

2)

projanim = 1 005 ;Action id 1005 is Shinobu's fireball animation

projhitanim = 1 006 ;Action id when fireball hits

offset = 70, -53 ;Creation offset from player (x,y)

velocity = 3.5, 0 ;Speed fireball moves (x,y) (optional)

Here we tell MUGEN that we are gonna use animation no. 1005 for the fireball frames when the projectile is moving in the screen (projanim = 1005)....

Ryu's animation no. 1005: Fireball

.. and animation no.1006 if the fireball hit the opponent (projhitanim = 1006).

Ryu's animation no. 1006: Fireball hitting the opponent

We also tell the position in the screen where the fireball will appear. (offset=70,-53). This is is relative to the position of the player, so in this case the fireball will appear 70 pixels to the right and 53 up from the character. You will probably find the right values for your char by trial and error....

Finally,we use the velocity parameter (velocity = 3.5, 0 ) to define how fast will the Fireball move in the screen. Notice that we use a positive value for X (3.5) , and 0 for Y : this means that the Fireball will NOT move vertically , only horizontally.

As a side note , everyone knows that Ryu has 3 punch buttons , and the stronger the button you press the faster the projectile goes. As shown above you can change the speed of the Fireball just by altering the X part of the velocity controller.

3)

HitDef part of projectile info

attr = S, SP

damage = 72,4

getpower = 60

givepower = 40

guardflag = MA

pausetime = 0,12

sparkno = 0,7

sparkxy = 0, 0

hitsound = 5,4

guardsound = 6,0

ground.type = High

ground.slidetime = 15

ground.hittime = 20

ground.velocity = -8

airguard.velocity = -3.5,-2.75

air.velocity = -2.5,-5.5

air.juggle = 3

air.fall = 1

This part of the state is just the standard Hitdef we use for EVERY attack in MUGEN. We use the same parameters and the same values.

We of course tell the engine that this a special move,and that this is a projectile (attr = S, SP meaning Standing move ,SpecialmoveProjectile). The rest of the parameters are either obvious , (damage, getpower,givepower) or very similar to other attacks in MUGEN (guardflag,sparkno), so I'm not gonna describe them in detail. I will probably make a special Hitdef section soon, explaining EVERY parameter in it, but for now I 'm not going deeper, as it doesn't pertain specifically to Fireball programming.

4)

[State 1000, 6] type = ChangeState trigger1 = AnimTime = 0 value = 0 ctrl = 1

We end State 1000 by changing the player back to his standing state (ChangeState value=0) and giving him control again, so he can continue making moves. (ctrl=1)

SUMMARY

We have learned how to program our character to make him throw fireballs. Let's see how we did it, with this quick overview:

1) In the CMD file always check that the characther hasn't already thrown a Fireball (if you want only one fireball on screen that is..)

triggerall = numproj = 0

go here for a more detailed explanation

2) In the CNS file when you are doing the Statedef, remember that inthe "anim" line is the animation of your character not the animation of the fireball itself.

go here for a more detailed explanation

3) Create the fireball using the Fireball controller. Tell MUGEN which position you want it to appear in the screen,which animation the fireball is going to use, and which velocity is going to have:

[State 1000, 4]

type = Projectile

trigger1 = AnimElem = 4

projanim = 1005 ;Action id 1005 is Shinobu's fireball animation

projhitanim = 1006 ;Action id when fireball hits

offset = 70, -53 ;Creation offset from player (x,y)

velocity = 3.5, 0 ;Speed fireball moves (x,y) (optional)

go here for a more detailed explanation

4) After defining those parameters ,use the hitfdef attributes (givepower,getpower,etc) as you do with the other attacks in MUGEN

5) Please note that the colors needed for the fireballs must be included with the rest of your chars colors. That is: you can't have one pallete (ACT file) for your character and other totally devoted to the fireball. There can only be ONE pallete file per character.

That's it !!!! Start creating Ryu clones!!! : )

back to Tutorial Index