Re: [問題] 遊戲中 子彈發射的間隔
吃光
private var keys:Array = [];
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
private function onKeyDown(event:KeyboardEvent):void
{
keys[event.keyCode] = true;
}
private function onKeyUp(event:KeyboardEvent):void
{
keys[event.keyCode] = false;
}
private function onEnterFrame(event:Event):void
{
if (keys[Keyboard.LEFT]) player.x -= SPEED;
if (keys[Keyboard.RIGHT]) player.x += SPEED;
}
試看看
專治按鍵打架
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 124.12.215.43
討論串 (同標題文章)
Flash 近期熱門文章
PTT數位生活區 即時熱門文章
0
18