function DirectionUsed() {
if (Input.isPressed("left") && Input.isPressed("down")) return 1;
else if (Input.isPressed("right") && Input.isPressed("down")) return 3;
else if (Input.isPressed("left") && Input.isPressed("up")) return 7;
else if (Input.isPressed("right") && Input.isPressed("up")) return 9;
else if (Input.isPressed("down")) return 2;
else if (Input.isPressed("left")) return 4
else if (Input.isPressed("right")) return 6
else if (Input.isPressed("up")) return 8
else return 0
}
Game_Player.prototype.moveByInput = function() {
if (!this.isMoving() && this.canMove() && PCM === true) {
if (PlayerDirection > 0) {
$gameTemp.clearDestination();
} else if ($gameTemp.isDestinationValid()){
var x = $gameTemp.destinationX();
var y = $gameTemp.destinationY();
PlayerDirection = this.findDirectionTo(x, y);
}
if ([2, 4, 6, 8].contains(DirectionUsed())) this.executeMove(PlayerDirection); //!!!contains doesnt work with a function!!!
else if (DirectionUsed() === 1) this.moveDiagonally(4, 2);
else if (DirectionUsed() === 3) this.moveDiagonally(6, 2);
else if (DirectionUsed() === 7) this.moveDiagonally(4, 8);
else if (DirectionUsed() === 9) this.moveDiagonally(6, 8);
}
};