home *** CD-ROM | disk | FTP | other *** search
- function setVelocity(xdelta, ydelta)
- {
- vx = xdelta;
- vy = ydelta;
- }
- function step()
- {
- m_flightTime++;
- vy += _parent._parent.g_grav;
- _Y = _Y + vy;
- _X = _X + vx;
- radians = Math.atan(vy / vx);
- if(vx > 0)
- {
- _rotation = radians * 180 / 3.14159;
- }
- else
- {
- _rotation = radians * 180 / 3.14159 + 180;
- }
- if(vx < 0.00001 && vx > -0.00001)
- {
- _rotation = _rotation + 180;
- }
- if(boundaryTimer-- < 0)
- {
- boundaryTimer = 25;
- if(_X < xmin || _X > xmax || _Y > ymax)
- {
- this.unloadMovie();
- }
- }
- if(flameDebrisTimer-- < 0)
- {
- flameDebrisTimer = 0;
- var _loc3_ = _parent._parent.addObj("oil_glob",_parent._parent.debris_layer,_parent._parent.getNextDebrisLevel());
- _loc3_._x = _X;
- _loc3_._y = _Y;
- _loc3_._rotation = _rotation;
- _loc3_._xscale = _loc3_._yscale = 30 + rank * 20;
- _loc3_.decayRate = 6;
- }
- testHitEnemies();
- }
- function testHitEnemies()
- {
- var _loc4_ = undefined;
- var _loc5_ = false;
- var _loc3_ = 0;
- while(_loc3_ < _parent._parent.enemies.length && !_loc5_)
- {
- _loc4_ = _parent._parent.enemies[_loc3_];
- if(_loc4_.hitBox.hitTest(_X,_Y,0))
- {
- _loc5_ = true;
- break;
- }
- _loc3_ = _loc3_ + 1;
- }
- if(_loc5_)
- {
- _parent._parent.playSound("blood_splat.wav");
- if(_loc4_.etype == "air_ship")
- {
- _loc4_.testHitTroops(this);
- }
- if(_loc4_.etype == "greese" || _loc4_.etype == "steel")
- {
- _loc4_.takeDamage(0,_X,_Y);
- }
- else
- {
- _parent._parent.addSticky("sticky_greese",_loc4_,_X,_Y,20 + rank * 20);
- _loc4_.takeDamage(Math.ceil(rank / 2),_X,_Y);
- _parent._parent.updateRankGreese(getFlightBonus(10) + 5);
- }
- this.unloadMovie();
- }
- }
- function testHitTroops(obj)
- {
- if(obj.archer != null && obj.archer.hitTest(_X,_Y,0))
- {
- obj.archer.unloadMovie();
- _parent._parent.addFlyingTroop("deb_ene_archer",_X,_Y,obj.archer._xscale,obj.archer._yscale);
- }
- else if(obj.boss != null && obj.boss.hitTest(_X,_Y,0))
- {
- _parent._parent.updateRankGreese(getFlightBonus(10) + 5,_X,_Y);
- _parent._parent.addFlyingTroop("deb_ene_boss",_X,_Y,obj.archer._xscale,obj.archer._yscale);
- obj.boss.unloadMovie();
- }
- else if(obj.foot1 != null && obj.foot1.hitTest(_X,_Y,0))
- {
- _parent._parent.addFlyingTroop("deb_ene_foot",_X,_Y,obj.archer._xscale,obj.archer._yscale);
- obj.foot1.unloadMovie();
- }
- else if(obj.foot2 != null && obj.foot2.hitTest(_X,_Y,0))
- {
- _parent._parent.addFlyingTroop("deb_ene_foot",_X,_Y,obj.archer._xscale,obj.archer._yscale);
- obj.foot2.unloadMovie();
- }
- else if(obj.flagger != null && obj.flagger.hitTest(_X,_Y,0))
- {
- _parent._parent.addFlyingTroop("deb_ene_cat",_X,_Y,obj.archer._xscale,obj.archer._yscale);
- obj.flagger.unloadMovie();
- }
- }
- function getFlightBonus(amt)
- {
- var _loc1_ = m_flightTime / 10;
- if(_loc1_ > 4)
- {
- _loc1_ = 4;
- }
- return Math.ceil(_loc1_ * amt);
- }
- xmax = _parent._parent.g_width + 10;
- ymax = _parent._parent.g_ground + 10;
- flameDebrisTimer = 0;
- _rotation = random(360);
- xmax = _parent._parent.g_width + 50;
- xmin = -50;
- ymin = -50;
- ymax = _parent._parent.g_ground + 50;
- boundaryTimer = 50;
- var m_flightTime = 0;
-