文件名称:吹泡泡源码
文件大小:8KB
文件格式:AS
更新时间:2015-01-03 11:18:42
源码
男孩吃泡泡送给女孩来表达自己的心意。 public function onStart(e:MouseEvent):void//游戏开始 { score = 0; count = 0; starNum = 3; pao.visible = true; life1.visible = true; life2.visible = true; life3.visible = true; redHeart.gotoAndStop(1); redHeart.visible = false; replayBtn.visible = false; //pauseButtn.visible = true; scoreTxt.textColor = 0x00ff00;//设置文本框字体颜色 scoreTxt.text = String(score); gotoAndStop(2);//画面停到第2帧************ addStar(id);//调用3个星星 this.addChild(pao); addPaopao();//调用一个泡泡 this.addChildAt(fengcheMC,this.numChildren); this.addEventListener(MouseEvent.MOUSE_MOVE,onMove); Mouse.hide();//隐藏鼠标 this.addEventListener(Event.ENTER_FRAME,onPengZhuang); this.addEventListener(Event.ENTER_FRAME,onShow); pauseButtn.addEventListener(MouseEvent.CLICK,onClick); } public function addStar(id):void//显示星星函数 { for(id = 1; id <= starNum; id++) { var index:Number = Math.random(); if(index < 0.5) { star[id] = new Star();//调用黄色星星 star[id].name = "yellow star";//显示对象重命名 this.addChild(star[id]); star[id].x = Math.random() * stage.width/2 + starTop; star[id].y = Math.random() * stage.height/2; } else { star[id] = new Star0();//调用红色星星 star[id].name = "red star";//显示对象重命名 this.addChild(star[id]); star[id].x = Math.random() * stage.width/2 + starTop;