home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / insuranc.swf / scripts / __Packages / Bullet.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  751 b   |  38 lines

  1. class Bullet extends MovieClip
  2. {
  3.    var pos;
  4.    var vel;
  5.    var type;
  6.    function Bullet()
  7.    {
  8.       super();
  9.       this.pos = new flash.geom.Point();
  10.       this.vel = new flash.geom.Point();
  11.    }
  12.    function step(plVel)
  13.    {
  14.       this.pos.x += this.vel.x;
  15.       if(this.type == 0)
  16.       {
  17.          this.pos.y += this.vel.y;
  18.       }
  19.       else if(this.type == 1)
  20.       {
  21.          this.pos.y += - plVel.y;
  22.       }
  23.       if(this.pos.y > Game.screenH + 50)
  24.       {
  25.          Game.getInstance().removeShot();
  26.       }
  27.       if(this.pos.y < -50)
  28.       {
  29.          Game.getInstance().removeObstacle();
  30.       }
  31.    }
  32.    function draw(Void)
  33.    {
  34.       this._x = this.pos.x;
  35.       this._y = Game.screenH - this.pos.y;
  36.    }
  37. }
  38.