Two Sided Character

From Infinitywiki

Jump to: navigation, search

A Two Sided Character in Mugen is one who looks different when they face either left or right. By default in mugen all characters are one sided, which means that they look exactly the same if they face left or right. A good example of a one sided character is Sagat from Street Fighter. When he is facing right his eye patch is on his left eye but when he turns to face left the image simply mirrors and so the eye patch is on the left eye.

One Sided Character:


In order to over come this issue a character in mugen requires two complete set of sprites progrmmed in such a way so that the correct sprites will show accorsing to the direction the character is facing, such as is seen in Street Fighter III Gill by Kong.

Two Sided Character"


This tutorial will cover how to set up such a character using Fighter Factory


SFF File

In order to create a Two Sided Character you will need two full sets of character sprites in the SFF file. The first set of sprites will follow the typical pattern as found in other mugen characters. For more information on this seet he Character Creation Tutorial

The group and sprite number of the first set will look something like this:


Now through out this process we need to pick a significantly large and simple to use number that will help keep everything organized. By default mugen uses standards for items up to 5 digits so let's take the simplest 6 digit number, which will be 10,000. Now the second set of sprites will use group numbers and sprite numbers as such:


As you can see the paterns are all the same except that 10,000 has been added to the group number in every case. Once you have two full set of characters sprites saved in the SFF file you can save and move on to the AIR file.

AIR File

OK, now that your SFF file is done you need to get all the animations done as well. Let's assumed that all of the animations for the main set of sprites are already finished. This will save time and effort since you will be copying and pasting these animations.

1) Open the AIR file in notepad

2) Select all the animation (everything except for the FX, because those won't need to be doubled) and copy it.

3) Past all the animations at the bottom of the file (at the bottom for convienece)

4) All these animations that you pasted now need to be convered to work with the "reversed" sprites. If I remember correctly the magic number is 10,000 so you need to add 10,000 to all of the "begin action" numbers and to all the group numbers.

So for example, the stance that was copied down at the bottom that looks something like this:

[Begin Action 0]
Clsn2Default: 3
Clsn2[0] = -10, -92, 12, -72
Clsn2[1] = -24, -76, 19, -24
Clsn2[2] = -35, -23, 35, 1
0,0, 0,0, 4
0,1, 0,0, 4
0,2, 0,0, 4
0,3, 0,0, 4
0,4, 0,0, 4

Will now look like this:

[Begin Action 10000]
Clsn2Default: 3
Clsn2[0] = -10, -92, 12, -72
Clsn2[1] = -24, -76, 19, -24
Clsn2[2] = -35, -23, 35, 1
10000,0, 0,0, 4
10000,1, 0,0, 4
10000,2, 0,0, 4
10000,3, 0,0, 4
10000,4, 0,0, 4

You can test this with just one animation if you'd like. Save this notepad file, close it and go open your character in Fighter Factory. You'll find that in your Animations you have "action 0" which is the stance, and "action 1000" which is the reversed stance.

Now that you checked that this works you can close out of Fighter Factory, go back to notepad and finish the rest of the animations.

You should have already copied all of the original animations to the bottom of the AIR file so just go through all the numbers, adding 10,000 to the begin action numbers and to the group numbers. I use CTRL C and CTRL V to copy and past here, it can save a lot of time.

Save often.

CNS File

The CNS has some easy parts and some more difficult parts. You will need to go through every statedef and edit one line of code. Let's use the Light Punch for example, [statedef 200]

It starts out like this...

[Statedef 200]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
anim = 200
poweradd = 15
sprpriority = 2

And you'll edit the anim to look like this...

[Statedef 200]
type    = S
movetype= A
physics = S
juggle  = 4
ctrl = 0
anim = ifelse (facing = -1, 10200, 200)
poweradd = 15
sprpriority = 2

As you can see, the "ifselse" code says that if the character is facing left use animation 10200, otherwise use animation 200. Do this for all the state defs in your char's CNS files but the really tricky one's will be in the common1.cns file because they don't have the normal "anim" line of code.


In the mugen/data folder is a file called common1.cns file. This has all of the shared code for all of the characters in your mugen game, things like standing, walking, jumping, guarding and getting hit are found in this file. But if you mugen character has a common1.cns file in their own folder then they will not use the mugen/data/common1.cns file, instead they'll use the one found in their own folder. Any character using the Reversing Sprites method must have their own common1.cns file in the folder. If they don't have one already then copy the one out of the mugen/data folder into your char's folder.

Turning Workaround

Turns (stand and crouch) are the only states that you can not program in mugen. You'll notice it's not in the common1.cns file, there is no [statedef 5] or [statedef 6] and you can not override them so here is the work around...

Add the following to [statedef -2]:

[State -2, Crouch changes]
type = changeanim
trigger1 = facing = -1
trigger1 = anim = 6
trigger1 = anim != 10006
value = 10006

[State -2, Crouch changes]
type = changeanim
trigger1 = facing = -1
trigger1 = anim = 5
trigger1 = anim != 10005
value = 10005
Personal tools
Infinity Network