home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / ShotHostile.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  1.0 KB  |  39 lines

  1. class ShotHostile extends Shot
  2. {
  3.    var flightTime;
  4.    var acc;
  5.    var ct;
  6.    var bChopper;
  7.    var velocity;
  8.    var position;
  9.    var screenPos;
  10.    function ShotHostile(sLinkageId, pos, vel, newFlightTime)
  11.    {
  12.       super(sLinkageId,pos,vel);
  13.       this.flightTime = newFlightTime;
  14.       this.acc.x = 0;
  15.       this.acc.y = -0.15;
  16.       this.ct = null;
  17.       this.bChopper = false;
  18.    }
  19.    function step(Void)
  20.    {
  21.       if(this.flightTime-- > 0)
  22.       {
  23.          this.velocity.x += this.acc.x;
  24.          this.velocity.y += this.acc.y;
  25.          this.position.x += this.velocity.x;
  26.          this.position.y += this.velocity.y;
  27.          if(this.screenPos.y < 50 || this.screenPos.y > Game.screenH || this.screenPos.x < -30 || this.screenPos.x > Game.screenW + 30)
  28.          {
  29.             Game.getInstance().removeHostileShot(this);
  30.          }
  31.       }
  32.       else
  33.       {
  34.          Game.getInstance().createExplosion(this.position);
  35.          Game.getInstance().removeHostileShot(this);
  36.       }
  37.    }
  38. }
  39.