home *** CD-ROM | disk | FTP | other *** search
- _global.elevatorLogic = function()
- {
- if(!_root.onPlatform)
- {
- if(this.hitBox.hitTest(_root.game.player) && _root.playerDy >= 0)
- {
- if(this._y != this.limit)
- {
- this.moving = true;
- }
- if(this._y < this.limit)
- {
- this.dy = 12;
- }
- else
- {
- _root.game.player._y -= 32;
- this.dy = -12;
- }
- _root.currentPlatform = this;
- _root.onPlatform = true;
- }
- }
- else if(_root.currentPlatform == this)
- {
- if(this.hitBox.hitTest(_root.game.player))
- {
- _root.onPlatform = true;
- if(!_root.playerJumping)
- {
- _root.playerDy = this.dy;
- _root.gravity = 0;
- if(this.dy > 0)
- {
- _root.game.player._y -= _root.game.player._y - this._y + _root.playerHeight + 20;
- }
- else
- {
- _root.game.player._y -= _root.game.player._y - this._y + _root.playerHeight + 40;
- }
- }
- else
- {
- _root.onPlatform = false;
- _root.currentPlatform = 0;
- _root.playerDy = -36 + this.dy / 3;
- _root.gravity = _root.globalGravity;
- }
- }
- else if(_root.currentPlatform == this)
- {
- if(Math.abs(_root.game.player._y - this._y) > 160)
- {
- _root.onPlatform = false;
- }
- else if(_root.playerJumping)
- {
- _root.onPlatform = false;
- }
- }
- if(this.dy > 0)
- {
- if(this._y >= this.limit)
- {
- this.dy = 0;
- _root.onPlatform = false;
- _root.currentPlatform = 0;
- _root.playerDy = 0;
- _root.gravity = _root.globalGravity;
- this._y = this.limit;
- delete this.onEnterFrame;
- }
- }
- else if(this.dy < 0)
- {
- if(this._y <= this.limit)
- {
- this.dy = 0;
- _root.onPlatform = false;
- _root.currentPlatform = 0;
- _root.playerDy = 0;
- _root.gravity = _root.globalGravity;
- this._y = this.limit;
- delete this.onEnterFrame;
- }
- }
- }
- if(this.dy < 0 && this._y > this.limit || this.dy > 0 && this._y < this.limit)
- {
- this._y += this.dy;
- }
- };
- _global.liftLogic = function()
- {
- this.distx = Math.abs(this._x - _root.game.player._x);
- if(this._currentFrame <= 50)
- {
- this.dy = -6;
- }
- else
- {
- this.dy = 6;
- }
- if(!_root.onPlatform)
- {
- if(this.hitBox.hitTest(_root.game.player) && this.distx < 300)
- {
- if(this.hitBox2.hitTest(_root.game.player))
- {
- _root.currentPlatform = this;
- _root.onPlatform = true;
- _root.playerDy = this.dy;
- _root.gravity = 0;
- }
- }
- }
- else if(_root.currentPlatform == this)
- {
- if(this.hitBox.hitTest(_root.game.player))
- {
- if(!_root.playerJumping)
- {
- _root.game.player._y -= 6;
- _root.gravity = 0;
- _root.playerDy = this.dy;
- _root.onPlatform = true;
- }
- else
- {
- _root.onPlatform = false;
- _root.currentPlatform = 0;
- _root.playerDy = -36;
- _root.gravity = _root.globalGravity;
- }
- if(this.distx > 300)
- {
- _root.playerDy = 7;
- _root.onPlatform = false;
- _root.gravity = _root.globalGravity;
- _root.currentPlatform = 0;
- }
- }
- else if(this.distx < 300 && !_root.playerJumping)
- {
- if(this.hitBox2.hitTest(_root.game.player))
- {
- _root.onPlatform = true;
- _root.playerDy = this.dy;
- if(this.hitBox3.hitTest(_root.game.player))
- {
- _root.game.player._y += 3;
- }
- }
- }
- else
- {
- if(!_root.playerJumping)
- {
- _root.playerDy = 7;
- }
- _root.onPlatform = false;
- _root.gravity = _root.globalGravity;
- _root.currentPlatform = 0;
- }
- }
- };
- _global.beltLogic = function()
- {
- if(this.hitTest(_root.game.player))
- {
- _root.game.player._x += this.dx;
- }
- };
- _global.stompLogic = function()
- {
- if(this.hitTest(_root.game.player) && this._currentframe < 30)
- {
- if(!this.done)
- {
- _root.punch2.start();
- _root.playerState = "hurt";
- _root.playerHealth -= 10;
- _root.playerInvincible = true;
- this.done = true;
- }
- }
- else
- {
- this.done = false;
- }
- };
-