PDA

View Full Version : fighting games help


Zidane_ffs
10-01-2003, 10:01 PM
Yet again I need another question answered

I was wondering how it was possible to make a number of combos in a fighting game. I mean pressing three buttons at the same time to use a mov is easy but i want to make actual moves like having to press down, then right and finally the A button to shoot something.

Anyone help me with this?

Cheers
Zidane

jubei
10-01-2003, 11:31 PM
Possibly you could do it with variables. So if the user presses down, set punchCombo to true.

Then, if the next button is the next part of the combo, if the punchCombo == true, change punch2Combo to true.

Then, if the third button is part of the combo, test for punchCombo = true and punch2Combo = true, and if so execute a movieclip. Otherwise, if they're not both true set them both to false.

Then make sure that all the other buttons than those involved in the combo set punchCombo and punch2Combo to false.

It's a lot of working around, but with simple testing of boolean values, you can do quite complex actions.

Zidane_ffs
10-01-2003, 11:34 PM
sounds good, thanx for the help mate

Cheers
Zidane

omega10mg
10-02-2003, 02:30 PM
this is my idea on how to make a combo:

onClipEvent (load) {
combo = 0;
}
onClipEvent (enterFrame) {
//i use this keyPressed so it dosen't do the same over and over again if u hold down the buttom.
if (!keyPressed) {
if (Key.isDown(Key.LEFT)) {
//combocheck("left"); sends left key is pressed to the combocheck function.
combocheck("left");
keyPressed = Key.LEFT;
}
if (Key.isDown(Key.UP)) {
combocheck("up");
keyPressed = Key.UP;
}
if (Key.isDown(Key.RIGHT)) {
combocheck("right");
keyPressed = Key.RIGHT;
}
}
if (!Key.isDown(keyPressed)) {
keyPressed = false;
}

//fuction to check if you preformd a combo
//this is a check for a 3 press combo
function combocheck(lasthit) {
combo++;
if (combo == 1) {
firsthit = lasthit;
if (firsthit != "left") {
combo = 0;
}
}
if (combo == 2) {
secondhit = lasthit;
if (secondhit != "right") {
combo = 0;
}
}
if (combo == 3) {
thirdhit = lasthit;
if (thirdhit == "up") {
combo = 0;
//here if we pressed left, right then up we wanna play the combo animation.
_root.player.gotoAndPlay(2);
}
}
}
//function end
}



hope this can be to help... =) it helped me, becuase I forced myself to understand functions =P

Zidane_ffs
10-02-2003, 11:25 PM
Wow, thanx for all the script mate
I gotta a pretty good idea how I can use this

thanx again
Zidane