各位大大好,
小弟寫了小遊戲程式碼,卻遇到下列的錯誤訊息:
以下是小弟寫的程式碼:
- var main:int = 0 //計時變數var My_Time:Timer = new Timer(1000);My_Time.start();var mi:int = 0 , lo:int = 0 , si:int = 0 , fo:int = 0 , di:int = 0; var cate:int = 0;
- My_Time.addEventListener(TimerEvent.TIMER,GameStart);function GameStart (te:TimerEvent){ main += 1 ; trace(main); } /*監聽物件掉落事件*/this.addEventListener(Event.ENTER_FRAME,zuing);function zuing(Event) {mi_btn.y+=11;if (mi_btn.y>520) { mi_btn.y=10; mi_btn.x=Math.random()*340+10; mi_btn.visible = true; }lo_btn.y+=12;if(lo_btn.y>470){ lo_btn.y=15; lo_btn.x=Math.random()*340+10; lo_btn.visible = true; }si_btn.y+=13;if(si_btn.y>520){ si_btn.y=12; si_btn.x=Math.random()*340+10; si_btn.visible = true; }lo2_btn.y+=13;if(lo2_btn.y>470){ lo2_btn.y=10; lo2_btn.x=Math.random()*340+10; lo2_btn.visible = true; }mi2_btn.y+=13;if(mi2_btn.y>450){ mi2_btn.y=8; mi2_btn.x=Math.random()*340+10; mi2_btn.visible = true; }
- if (cate==15){ if(main <= 8){ gotoAndStop(1,"endgame"); removeEventListener(Event.ENTER_FRAME,zuing); My_Time.stop(); } else if(main >8 && main <=15){ gotoAndStop(2,"endgame"); removeEventListener(Event.ENTER_FRAME,zuing); My_Time.stop(); } else if(main >15 && main <=23){ gotoAndStop(3,"endgame"); removeEventListener(Event.ENTER_FRAME,zuing); My_Time.stop(); } else if(main >23 && main <=30 ){ gotoAndStop(4,"endgame"); removeEventListener(Event.ENTER_FRAME,zuing); My_Time.stop(); } else if(main >30){ gotoAndStop(5,"endgame"); removeEventListener(Event.ENTER_FRAME,zuing); My_Time.stop(); } }
- }
- mi_btn.addEventListener(MouseEvent.CLICK,inmi);function inmi(e:MouseEvent){ mi+=1; cate+=1; if(mi<=4){ mi_btn.visible = false; mi_txt.text=String(mi); //trace(mi); } else if(mi==5){ mi2_txt.text = "達成"; mi_txt.visible = false; this.removeChild(mi_btn); } }
- lo_btn.addEventListener(MouseEvent.CLICK,inlo);function inlo(e:MouseEvent){ lo+=1; cate+=1; if(lo<=4){ lo_txt.text = String(lo); lo_btn.visible = false; } else if(lo==5){ lo2_txt.text = "達成"; lo_txt.visible = false; this.removeChild(lo_btn); } } si_btn.addEventListener(MouseEvent.CLICK,insi);function insi(e:MouseEvent){ si+=1; cate+=1; if(si<=4){ si_txt.text = String(si); si_btn.visible = false; } else if(si==5){ si2_txt.text = "達成"; si_txt.visible = false; this.removeChild(si_btn); } }
- lo2_btn.addEventListener(MouseEvent.CLICK,inlo2);function inlo2(e:MouseEvent){ this.removeChild(mi_btn); this.removeChild(lo_btn); this.removeChild(si_btn); this.removeChild(lo2_btn); this.removeChild(mi2_btn); gotoAndStop(6,"endgame"); } mi2_btn.addEventListener(MouseEvent.CLICK,inmi2);function inmi2(e:MouseEvent){ this.removeChild(mi_btn); this.removeChild(lo_btn); this.removeChild(si_btn); this.removeChild(lo2_btn); this.removeChild(mi2_btn); gotoAndStop(6,"endgame"); }
複製代碼
煩請大大幫忙看看,小弟感激不盡啊!
... |