Re: [問題] 遊戲中 子彈發射的間隔

看板Flash作者 (眼殘)時間11年前 (2013/10/10 20:06), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
吃光 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
文章代碼(AID): #1ILfX6X- (Flash)
文章代碼(AID): #1ILfX6X- (Flash)