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(_X < -10 || _X > xmax || _Y > ymax)
- {
- this.unloadMovie();
- }
- if(flameDebrisTimer-- < 0)
- {
- flameDebrisTimer = 0;
- var _loc3_ = _parent._parent.addObj("flame_spark",_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_)
- {
- if(_loc4_.etype == "air_ship")
- {
- _parent._parent.woodExplosion(_X,_Y,Math.ceil(rank / 2.5));
- _loc4_.testHitTroops(this);
- }
- var _loc9_ = undefined;
- var _loc8_ = false;
- if(_loc4_.etype != "fire")
- {
- if(_loc4_.etype == "air_ship" || _loc4_.etype == "dragon_archer" || _loc4_.etype == "dragon_scout" || _loc4_.etype == "greese")
- {
- _parent._parent.addSticky("sticky_fire",_loc4_,_X,_Y,20 + rank * 20);
- _loc4_.takeDamage(rank * 2,_X,_Y);
- _loc9_ = rank * 10;
- _parent._parent.updateRankFire(getFlightBonus(10) + 5);
- _loc8_ = true;
- _parent._parent.playSound("shoot_rocket.wav");
- }
- else if(_loc4_.etype == "ice")
- {
- _loc4_.takeDamage(rank * 5,_X,_Y);
- _loc9_ = rank * 20;
- _parent._parent.updateRankFire(getFlightBonus(20) + 10);
- _loc8_ = true;
- _parent._parent.playSound("ice_shatter.wav");
- }
- else if(_loc4_.etype == "steel")
- {
- _loc9_ = 10;
- _parent._parent.playSound("ching2.wav");
- }
- else
- {
- _loc4_.takeDamage(rank * 2,_X,_Y);
- _loc9_ = rank * 10;
- _parent._parent.updateRankFire(getFlightBonus(10) + 5);
- _loc8_ = true;
- _parent._parent.playSound("shoot_rocket.wav");
- }
- var _loc7_ = _parent._parent.addObj("explosion_pow",_parent._parent.debris_layer,_parent._parent.getNextDebrisLevel());
- _loc7_._x = _X;
- _loc7_._y = _Y;
- _loc7_._rotation = random(360);
- _loc7_._xscale = _loc7_._yscale = _loc9_;
- }
- else
- {
- _loc4_.takeDamage(0,_X,_Y);
- _parent._parent.playSound("ching2.wav");
- }
- if(!_loc8_)
- {
- var _loc6_ = _parent._parent.addObj("deflect_flame",_parent._parent.debris_layer,_parent._parent.getNextDebrisLevel());
- _loc6_._x = _X;
- _loc6_._y = _Y;
- var _loc10_ = Math.sqrt(vx * vx + vy * vy) * 0.75;
- var _loc11_ = random(360);
- _loc6_.vx = Math.cos(0.017453292519943295 * _loc11_) * _loc10_;
- _loc6_.vy = Math.sin(0.017453292519943295 * _loc11_) * _loc10_;
- _loc6_._xscale = _loc6_._yscale = _xscale;
- _loc6_.rank = rank;
- }
- this.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;
- xmax = _parent._parent.g_width + 50;
- xmin = -50;
- ymin = -50;
- ymax = _parent._parent.g_ground + 50;
- boundaryTimer = 50;
- var m_flightTime = 0;
-