home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / climatechaos.swf / scripts / __Packages / Building.as next >
Encoding:
Text File  |  2008-09-12  |  2.1 KB  |  81 lines

  1. class Building extends Position
  2. {
  3.    var radius;
  4.    var pos_x;
  5.    var pos_y;
  6.    var room;
  7.    var environment;
  8.    var nx;
  9.    var zs;
  10.    var z;
  11.    var offscreen;
  12.    var ny;
  13.    function Building()
  14.    {
  15.       super();
  16.       this.radius = 65;
  17.    }
  18.    function collide(p_new_x, p_new_y, p_old_x, p_old_y)
  19.    {
  20.       var _loc3_ = p_new_x;
  21.       var _loc2_ = p_new_y;
  22.       var _loc8_ = p_old_x;
  23.       var _loc6_ = p_old_y;
  24.       var _loc12_ = _loc8_ - this.pos_x;
  25.       var _loc11_ = _loc6_ - this.pos_y;
  26.       var _loc7_ = _loc3_ - this.pos_x;
  27.       var _loc4_ = _loc2_ - this.pos_y;
  28.       if(this.positive(_loc7_) < 10 && _loc4_ > 0)
  29.       {
  30.          if(_loc4_ < this.radius - 20)
  31.          {
  32.             this.environment.goInside(this,this.room);
  33.          }
  34.       }
  35.       else
  36.       {
  37.          _loc3_ = p_new_x;
  38.          _loc2_ = p_new_y;
  39.          if(this.distanceTo(_loc3_,_loc2_) < this.radius)
  40.          {
  41.             var _loc5_ = this.angleTo(_loc3_,_loc2_);
  42.             _loc3_ = this.pos_x + Math.sin(_loc5_) * this.radius;
  43.             _loc2_ = this.pos_y - Math.cos(_loc5_) * this.radius;
  44.          }
  45.       }
  46.       return [_loc3_,_loc2_];
  47.    }
  48.    function render(p_env)
  49.    {
  50.       this.posit(p_env);
  51.       if(this.nx < 550 + 150 * this.zs && this.nx > - 150 * this.zs && this.z > -400)
  52.       {
  53.          this.offscreen = false;
  54.          this._x = this.nx;
  55.          this._y = this.ny;
  56.          this._xscale = this._yscale = 60 * this.zs;
  57.          this.blur(this.ny);
  58.          this.depth();
  59.          if(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100) < 1)
  60.          {
  61.             this.gotoAndStop(1);
  62.          }
  63.          else if(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100) > 35)
  64.          {
  65.             this.gotoAndStop(35);
  66.          }
  67.          else
  68.          {
  69.             this.gotoAndStop(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100));
  70.          }
  71.          this.fade();
  72.       }
  73.       else if(this.offscreen == false)
  74.       {
  75.          this.offscreen = true;
  76.          this._x = -200;
  77.          this._y = -200;
  78.       }
  79.    }
  80. }
  81.