|
|
|
|
点击浏览该文件
点击浏览该文件
主场景中ball的帧内容:


_root.ang=-40; _root.total=0; _root.attachMovie("fly","fly",10,{_x:random(300)+220,_y:random(220)+10}); up_btn.onPress=function(){ turnangle(5); if(gun_mc._rotation<-85){ gun_mc._rotation=-85; } } down_btn.onPress=function(){ turnangle(-5); if(gun_mc._rotation>-5){ gun_mc._rotation=-5; } } function turnangle(tmp){ gun_mc._rotation+=-1*tmp; _root.ang=gun_mc._rotation; } fire_btn.onPress=function(){ if(_root.ball._currentframe==1){ _root.ball.gotoAndPlay(2); } }
//------------------------------------
ball中第一帧:
stop (); _visible = false;
第二帧:
var rad = -_root.ang/180*Math.PI; _x = _root.gun_mc._x+80*Math.cos(rad); _y = _root.gun_mc._y-80*Math.sin(rad); var Vx = Math.sqrt(750)*Math.cos(rad); var Vy = -1*Math.sqrt(750)*Math.sin(rad); _visible = true;
第三帧:
var hitMon = this.hitTest(_root.fly); if (hitMon) { gotoAndPlay("HitBang"); } _x += Vx; _y += Vy; Vy++; if (_y>=350 || _x>550) { gotoAndPlay("Bang"); } trace(1);
第四帧:
gotoAndPlay (_currentframe-1);
第16帧:
gotoAndStop(1);
第17 帧
:_root.fly.removeMovieClip(); _root.total++;
第26帧
:_root.attachMovie("fly", "fly", 10, {_x:random(300)+220, _y:random(220)+10}); gotoAndStop(1); //------------------------------------------
你也可以试试. |
|
|