fixes #147, fixes #136, is related to but doesnt entirely complete #144

This commit is contained in:
logsol 2016-08-28 22:40:25 +02:00
parent 502cf72a7e
commit c87997c774
13 changed files with 134 additions and 27 deletions

View file

@ -10,14 +10,18 @@ function () {
this._shift;
this._isJumping;
this._walkingDirectionStatus = 0;
this.isInBetweenGames = false;
}
PlayerController.prototype.moveLeft = function () {
if(!this.isPlayerInputAllowed()) return;
this.player.move(-1);
this._walkingDirectionStatus = -1;
}
PlayerController.prototype.moveRight = function () {
if(!this.isPlayerInputAllowed()) return;
this.player.move(1);
this._walkingDirectionStatus = 1;
}
@ -28,6 +32,7 @@ function () {
}
PlayerController.prototype.jump = function () {
if(!this.isPlayerInputAllowed()) return;
this._isJumping = true;
this.player.jump();
}
@ -37,9 +42,18 @@ function () {
}
PlayerController.prototype.lookAt = function (options) {
if(!this.isPlayerInputAllowed()) return;
if(options) this.player.lookAt(options.x, options.y);
}
PlayerController.prototype.setIsInBetweenGames = function(isInBetweenGames) {
this.isInBetweenGames = !!isInBetweenGames;
};
PlayerController.prototype.isPlayerInputAllowed = function() {
return !this.isInBetweenGames;
};
PlayerController.prototype.update = function () {
if(this._walkingDirectionStatus != 0) {
this.player.move(this._walkingDirectionStatus);