PDA

View Full Version : Mortal Kombat!!!!


Murphy1976
08-21-2007, 03:03 AM
Good Evening Flash Gurus,

Here's my dilemma. I'm creating a mortal kombat style game where the movement, punch, kick, block, jump and power move controls are all scripted in the keyboard. I have two MCs that both have a good deal of clipEvent(keyDown) and clipEvent(keyUp) instances (well one of each, actually, but both notions hold a lot of code).

The problem I'm running into, is that when I'm controlling one of the MCs with the specific keystrokes that control him, I can't control the other MC until all keys have been released.

How can I re-code these two MCs (hopefully not much modification will be needed) so that I can control each MC independently no matter who's doing what to the keyboard.

I await your vast wisdom!

Flash Gordon
08-21-2007, 03:18 AM
try this:
http://www.actionscript.org/resources/articles/192/1/Detecting-Key-Combinations/Page1.html

pleribus
08-29-2007, 07:22 AM
I ran into similar problems with my game and found that simply using a series of if statements like:

if (Key.isDown(Key.UP)){
//do something
}

if (Key.isDown(Key.DOWN)){
//do something
}

if (Key.isDown(Key.SPACE)){
// jump
}

that is run on each frame update got around multiple key press combinations.
Pressing both down and space will execute both their actions.