茹一刷牙牙片:有AS 高手吗 帮我解决一下个问题

来源:百度文库 编辑:中科新闻网 时间:2024/05/04 06:21:48
onClipEvent (enterFrame) {
function move() {
_y -= (Math.cos(Math.PI/180*this._rotation))*speed;
_x += (Math.sin(Math.PI/180*this._rotation))*speed;
}
if (Key.isDown(Key.UP)) {
move();
}
if (Key.isDown(Key.DOWN)) {
move();
}
if (Key.isDown(Key.LEFT)) {
_rotation -= 3;
}
if (Key.isDown(Key.RIGHT)) {
_rotation += 3;
}
if (Key.isDown(Key.UP) && !(Key.isDown(Key.DOWN)) && speed>-3 && speed<3) {
speed += 0.1;
}
if (Key.isDown(Key.DOWN) && !(Key.isDown(Key.UP)) && speed>-3 && speed<3) {
speed -= 0.1;
}
if ((speed>0.1) && (!Key.isDown(Key.UP)) && (!Key.isDown(Key.DOWN))) {
move();
speed -= 0.05;
}
if ((speed<-0.1) && (!Key.isDown(Key.UP)) && (!Key.isDown(Key.DOWN))) {
move();
speed += 0.05;
}
if ((Key.isDown(Key.UP)) && (Key.isDown(Key.DOWN))) {
speed /= 1.1;
if ((speed>-0.1) && (speed<0.1)) {
speed = 0;
}
}
if (_x<=0) {
_x = 600;
} else if (_x>=600) {
_x = 0;
}
if (_y<=0) {
_y = 450;
} else if (_y>=450) {
_y = 0;
}
}
这个代码在flash 8.0里面怎么只能使物体转动 而不能使物体前行呀

代码没错 逻辑错误