I’m trying to get the characters in this Flash game to move diagonally - it works, but the following occurs:
[list=1]
[]The character is walking [size=4]twice[/size] as fast as it does when going [size=1]left, right, up, down[/size]
[]The walking animation doesn’t play
[/list]
onClipEvent (load) {
walkSpeed = 3;
stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(key.DOWN)) {
_y += walkSpeed;
this.gotoAndStop(1);
}
if (Key.isDown(Key.UP)) {
_y -= walkSpeed;
this.gotoAndStop(2);
}
if (Key.isDown(key.LEFT)) {
_x -= walkSpeed;
this.gotoAndStop(3);
}
if (Key.isDown(key.RIGHT)) {
_x += walkSpeed;
this.gotoAndStop(4);
}
if (Key.isDown(Key.LEFT) & Key.isDown(Key.UP)) {
this.gotoAndStop(5);
_x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT) & Key.isDown(Key.UP)) {
this.gotoAndStop(6);
_x += walkSpeed;
}
if (Key.isDown(Key.DOWN) & Key.isDown(Key.LEFT)) {
this.gotoAndStop(7);
_x -= walkSpeed;
}
if (Key.isDown(Key.DOWN) & Key.isDown(Key.RIGHT)) {
this.gotoAndStop(8);
_x += walkSpeed;
}
if (!Key.isDown(key.UP) & !Key.isDown(key.DOWN) & !Key.isDown(key.LEFT) & !Key.isDown(key.RIGHT)) {
this.gotoAndStop(9);
}
}
Can someone show me the way?