[HELP] character animation woes (variable conflicts)
i'm in the process of making a tribute to castlevania in flash. i've taken a few sprites from dracula x for now and i'm going through all the motions to try and get all the character's actions working with the corresponding animations.
the following is the code put on the character clip:
Code:
onClipEvent (load) {
this.whipping = false;
yvel = -15;
gravity = 2;
this.jumping = false;
this.ground = 360;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
whipping = true;
_root.richter.gotoAndStop("whipping");
}
if (Key.isDown(Key.LEFT)) {
_root.richter._xscale = -100;
if (whipping == false) {
_root.richter._x -= 3;
_root.richter.gotoAndStop("walk");
}
if (jumping == true and whipping == true) {
_root.richter._x -= 3;
}
} else if (Key.isDown(Key.RIGHT)) {
_root.richter._xscale = 100;
if (whipping == false) {
_root.richter._x += 3;
_root.richter.gotoAndStop("walk");
}
if (jumping == true and whipping == true) {
_root.richter._x += 3;
}
}
if (whipping == false and jumping == false and !(Key.isDown(Key.SPACE) or Key.isDown(Key.LEFT) or Key.isDown(Key.RIGHT) or Key.isDown(Key.UP))) {
_root.richter.gotoAndStop("stand");
}
if (Key.isDown(Key.UP)) {
jumping = true;
}
if (jumping == true) {
_root.richter.gotoAndStop("jump");
_root.richter._y += yvel;
yvel += gravity;
}
if (_root.richter._y>360) {
yvel = -15;
_root.richter._y = 360;
jumping = false;
}
}
my problem starts with the jump animation not playing all the way through, or when i press space to whip in the air, it doesn't play the whipping animation, etc. it's obviously a conflict of variables and conditions that tell when to play what frame for the character. but i've been so rushed with work, school, and the mrs. that i can't think straight.
could anyone possibly run through my code and see what i'm doing incorrectly? you'll have to forgive the sloppiness, as it's been a while since i've been back to flash.
cheers.