|
onClipEvent (load) { // 初始化瓢虫移动的速度 speed = 10; } onClipEvent (enterFrame) {//以影片剪辑的帧频连续触发该动作。 // 垂直/水平方向 if (Key.isDown(Key.LEFT) ) {//按下左键 _x -= speed; _rotation = 270; } if (Key.isDown(Key.RIGHT) ) {//右 _x += speed; _rotation = 90; } if (Key.isDown(Key.UP)) {//上 _y -= speed; _rotation = 0; } if (Key.isDown(Key.DOWN) ) {//下 _y += speed; _rotation = 180; } // 倾斜方向 if (Key.isDown(Key.LEFT) & Key.isDown(Key.UP)) { _rotation = 315; } if (Key.isDown(Key.RIGHT) & Key.isDown(Key.UP)) { _rotation = 45; } if (Key.isDown(Key.LEFT) & Key.isDown(Key.DOWN)) { _rotation = 225; } if (Key.isDown(Key.RIGHT) & Key.isDown(Key.DOWN)) { _rotation = 135; } // // 保证瓢虫在视线内 if (_y<0) { _y = 300; } if (_y>300) { _y = 0; } if (_x<0) { _x = 300; } if (_x>300) { _x = 0; } } 怎么改只能在300*300的空间里边走 而不能从左边穿过到右边 我用的是FLASH8
|