home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / rocket_rush.swf / scripts / __Packages / Obstacle.as < prev    next >
Encoding:
Text File  |  2007-03-20  |  762 b   |  36 lines

  1. class Obstacle extends Position
  2. {
  3.    var target_clip;
  4.    var onEnterFrame;
  5.    var range = 70;
  6.    var speed_z = -10;
  7.    function Obstacle()
  8.    {
  9.       super();
  10.       this.target_clip = this._parent.player;
  11.       this.onEnterFrame = function()
  12.       {
  13.          if(!_global.game_paused)
  14.          {
  15.             this.moveZ();
  16.             if(this.render_z < -200)
  17.             {
  18.                this.removeMovieClip();
  19.             }
  20.             if(this.checkTarget())
  21.             {
  22.                this._parent.player.getObstacled();
  23.             }
  24.          }
  25.       };
  26.    }
  27.    function checkTarget()
  28.    {
  29.       return this.distance3D(this.target_clip) < this.range;
  30.    }
  31.    function moveZ()
  32.    {
  33.       this.pos_z += this.speed_z;
  34.    }
  35. }
  36.