home *** CD-ROM | disk | FTP | other *** search
- function setVelocity(xdelta, ydelta)
- {
- vx = xdelta;
- vy = ydelta;
- }
- function step()
- {
- 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("snot_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;
- }
- if(hitTimer-- < 0)
- {
- 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 != "snot")
- {
- _parent._parent.addSticky("sticky_snot",_loc4_,_X,_Y,20 + rank * 20);
- _loc4_.takeDamage(Math.ceil(rank / 2),_X,_Y);
- }
- else
- {
- _loc4_.takeDamage(0,_X,_Y);
- }
- this.unloadMovie();
- }
- }
- 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;
- hitTimer = 50;
- boundaryTimer = 50;
-