k i have my 8 direction movement, but i am having some problems. When the player moves diagonal, the animation only seems to show the first frame, up, down, left and right are fine, but diagonals mess up. Here is my code...
onClipEvent (load) {
horspeed = 10;
vertspeed = 7;
}
onClipEvent (enterFrame) {
if (key.isdown(key.RIGHT)) {
this.gotoAndStop ("right_walk");
_x += horspeed;
}
if (key.isdown(key.LEFT)) {
_x -= horspeed;
this.gotoAndStop ("left_walk");
}
if (key.isdown(key.UP)) {
_y -= vertspeed;
this.gotoAndStop ("up_walk");
}
if (key.isdown(key.DOWN)) {
this.gotoAndStop ("down_walk");
_y += vertspeed;
}
if (key.isdown(key.RIGHT) && key.isdown(key.UP)) {
this.gotoAndStop ("diag_ur");
}
if (key.isdown(key.LEFT) && key.isdown(key.UP)) {
this.gotoAndStop ("diag_ul");
}
if (key.isdown(key.RIGHT) && key.isdown(key.DOWN)) {
this.gotoAndStop ("diag_dr");
}
if (key.isdown(key.LEFT) && key.isdown(key.DOWN)) {
this.gotoAndStop ("diag_dl");
}
}
Anyobody know why i get this problem? i am using Flash 5 by the way because i am cheap.
Also if anyone is able to tell me how i can make the character stand still facing the direction they have been moving, when the user lets go of the controls, that would be great.
Any help much appreciated, thanks
-Dave