So far I've gotten my character (Axel from Organization XIII of Kingdom Hearts, lol) to be able to move, jump, and use two different attacks (physical and a throwing attack).
I've even got a little Heartless AI, lol.
Now before I start making the damage system, I cannot figure out something.
For the attacks, I have them using a simple if to find if the key is down (control and shift keys for the two attacks), which is placed in the onClipEvent(enterFrame) loop. With this, the attacking clip only plays when the key is held, so it might not even display the full attack sequence, going back to the movement or standing frame. I need to have it display the full animation once per key stroke.
Here is my code for my character.
onClipEvent(load){
power = 3.5;
xspeed = 0;
yspeed = 0;
friction = 0.75;
gravity = 1;
thrust = 3;
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
xspeed -= power;
_xscale = -100;
gotoAndStop('walking');
_root.mugshot_mc.gotoAndStop('regular');
}
else if(Key.isDown(Key.RIGHT)){
xspeed += power;
_xscale = 100;
gotoAndStop('walking');
_root.mugshot_mc.gotoAndStop('regular');
}
if(Key.isDown(Key.CONTROL)){
gotoAndStop('attacking');
_root.mugshot_mc.gotoAndStop('angry');
}
if(Key.isDown(Key.SHIFT)){
gotoAndStop('throw');
_root.mugshot_mc.gotoAndStop('angry');
}
if(!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.UP) && !Key.isDown(Key.CONTROL) && !Key.isDown(Key.SHIFT)){
gotoAndStop('jumpDown');
_root.mugshot_mc.gotoAndStop('regular');
}
xspeed *= friction;
yspeed += gravity;
if((_y - (_height / 2) - 6) > 0 && _y < 358)
_y += yspeed;
else{
yspeed = 0;
if((_y - (_height / 2) - 5) <= 0) _y += 5;
else{
if(!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.CONTROL) && !Key.isDown(Key.SHIFT))
gotoAndStop('stand');
_y = 358;
}
}
if((_x - (_width / 2) - 6) > 0 && (_x + (_width / 2) + 6) < 550)
_x += xspeed;
else{
xspeed = 0;
if((_x - (_width / 2) - 6) <= 0) _x += 5;
else _x -= 5;
}
if(Key.isDown(Key.UP)){
_y -= power * thrust;
gotoAndStop('jumpUp');
}
}
Edit -
Oh, I also would like to know how to spawn instances of my enemies? I can't seem to get duplicateMovieClip() to work.
I'll also need to be able to remove movieclips when my character kills them. I can make the _alpha fade to 0, but it keeps invisibly attacking my character because it's still physically there, lol.
Edited by Demonslay, 09 February 2007 - 06:58 PM.
