Okay, so I’m working on a game for my design course, it’s a two player beat-em-up game, but right now I’m really stuck and quite desperate for help.
I’m quite inexperienced with flash, and this is my first major flash project, so excuse me if I’m unaware of some terms etc.
Right now I’m having an issue, I want to add an animation of jumping when I press the Up Key. I have created a “jumping” MC and placed it into my character’s movie clip (known as mcMain). Now I want to call the jumping movie clip from the actions in the main timeline, but it only plays the first frame of the jumping animation when you press the up arrow. My theory is that since the script is running on every frame, it’s continuously repeating the first frame.
Here is the jumping function:
//THE JUMPING FUNCTION PLAYER 1
function mainJump():Void{
//if main isn’t already jumping
if(!mainJumping){
if(Key.isDown(Key.UP)){
//then start jumping
jumpSpeed = jumpSpeedLimit*-1;
mcMain._y += jumpSpeed;
_root.mcMain.gotoAndStop("jumping");
_root.mcMain.jumping.nextFrame();
mainJumping = true;
}
} else {
if (Key.isUP(Key.UP)) {
mcMain.jumping.nextFrame();
}
I’ve attached the flash file so you can see my setup. The jumping MC is in the very last frame of the “mcMain” movie clip, with the “jumping” label.
Right now I do realise that the line of code in the above is:
_root.mcMain.gotoAndPlay(“jumping”);
And I think that’s the command to call on a label, but that is as close to an animation as I could get, so I thought I’d leave that in there as a placeholder.
If you do come up with a solution, would it be possible to then help me figure out how I can keep adding more and more animations to each button? I want to simulate different commands (punching, kicking, fireballs etc.) for this fighting game.
Any help on this would be much appreciated guys, I’m really happy there’s a place I can try to seek help, and I’m totally open to any solutions you come up with. I’m using Actionscript 2.0 for this project! Many thanks in advance!