rendered paste bodyonClipEvent (load) {
speed = 8;
var dir:String = "none";
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x += speed;
this.gotoAndStop("rr");
dir = "right";
this.rotate(10);
}
if (Key.isDown(Key.LEFT)) {
_x -= speed;
this.gotoAndStop("rl");
dir = "left";
}
if (Key.isDown(Key.UP)) {
_y -= speed;
this.gotoAndStop("ru");
dir = "up";
}
if (Key.isDown(Key.DOWN)) {
_y += speed;
this.gotoAndStop("rd");
dir = "down";
}
if (!Key.isDown(Key.RIGHT) && !Key.isDown(Key.DOWN) && !Key.isDown(Key.UP) && !Key.isDown(Key.LEFT)) {
if (dir == "up"){
this.gotoAndStop("u");
}
if (dir == "down"){
this.gotoAndStop("d");
}
if (dir == "right"){
this.gotoAndStop("r");
}
if (dir == "left"){
this.gotoAndStop("l");
}
}
}