home *** CD-ROM | disk | FTP | other *** search
- class Building extends Position
- {
- var radius;
- var pos_x;
- var pos_y;
- var room;
- var environment;
- var nx;
- var zs;
- var z;
- var offscreen;
- var ny;
- function Building()
- {
- super();
- this.radius = 65;
- }
- function collide(p_new_x, p_new_y, p_old_x, p_old_y)
- {
- var _loc3_ = p_new_x;
- var _loc2_ = p_new_y;
- var _loc8_ = p_old_x;
- var _loc6_ = p_old_y;
- var _loc12_ = _loc8_ - this.pos_x;
- var _loc11_ = _loc6_ - this.pos_y;
- var _loc7_ = _loc3_ - this.pos_x;
- var _loc4_ = _loc2_ - this.pos_y;
- if(this.positive(_loc7_) < 10 && _loc4_ > 0)
- {
- if(_loc4_ < this.radius - 20)
- {
- this.environment.goInside(this,this.room);
- }
- }
- else
- {
- _loc3_ = p_new_x;
- _loc2_ = p_new_y;
- if(this.distanceTo(_loc3_,_loc2_) < this.radius)
- {
- var _loc5_ = this.angleTo(_loc3_,_loc2_);
- _loc3_ = this.pos_x + Math.sin(_loc5_) * this.radius;
- _loc2_ = this.pos_y - Math.cos(_loc5_) * this.radius;
- }
- }
- return [_loc3_,_loc2_];
- }
- function render(p_env)
- {
- this.posit(p_env);
- if(this.nx < 550 + 150 * this.zs && this.nx > - 150 * this.zs && this.z > -400)
- {
- this.offscreen = false;
- this._x = this.nx;
- this._y = this.ny;
- this._xscale = this._yscale = 60 * this.zs;
- this.blur(this.ny);
- this.depth();
- if(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100) < 1)
- {
- this.gotoAndStop(1);
- }
- else if(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100) > 35)
- {
- this.gotoAndStop(35);
- }
- else
- {
- this.gotoAndStop(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 100));
- }
- this.fade();
- }
- else if(this.offscreen == false)
- {
- this.offscreen = true;
- this._x = -200;
- this._y = -200;
- }
- }
- }
-