home *** CD-ROM | disk | FTP | other *** search
- class SquareBuilding extends Building
- {
- var radius;
- var nx;
- var zs;
- var z;
- var offscreen;
- var ny;
- var pos_x;
- var pos_y;
- var room;
- var environment;
- function SquareBuilding()
- {
- super();
- this.radius = 85;
- }
- 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();
- this.gotoAndStop(17 + Math.round(17 * (p_env.pos_x - this.pos_x) / 520));
- if(this._y > 280)
- {
- this._alpha = 100 - (this.ny - 300) * 5;
- }
- }
- else if(this.offscreen == false)
- {
- this.offscreen = true;
- this._x = -200;
- this._y = -200;
- }
- }
- function collide(p_new_x, p_new_y, p_old_x, p_old_y)
- {
- var _loc5_ = p_new_x;
- var _loc4_ = p_new_y;
- var _loc8_ = p_old_x;
- var _loc6_ = p_old_y;
- var _loc9_ = _loc8_ - this.pos_x;
- var _loc7_ = _loc6_ - this.pos_y + this.radius;
- var _loc3_ = _loc5_ - this.pos_x;
- var _loc2_ = _loc4_ - this.pos_y + this.radius;
- if(this.positive(_loc3_) < 10 && _loc2_ > 0)
- {
- if(_loc2_ < this.radius + 10)
- {
- this.environment.goInside(this,this.room);
- }
- }
- else if(this.positive(_loc7_) > this.positive(_loc9_))
- {
- if(_loc2_ <= this.radius + 30 && _loc2_ > 0)
- {
- _loc4_ = this.pos_y + 30;
- }
- else if(_loc2_ >= - this.radius - 30 && _loc2_ < 0)
- {
- _loc4_ = this.pos_y - this.radius - this.radius - 30;
- }
- }
- else if(_loc3_ <= this.radius + 30 && _loc3_ > 0)
- {
- _loc5_ = this.pos_x + this.radius + 30;
- }
- else if(_loc3_ >= - this.radius - 30 && _loc3_ < 0)
- {
- _loc5_ = this.pos_x - this.radius - 30;
- }
- return [_loc5_,_loc4_];
- }
- }
-