Fixed bug in player movement
authorJustin Worthe <justin.worthe@entelect.co.za>
Thu, 17 Jul 2014 08:02:26 +0000 (10:02 +0200)
committerJustin Worthe <justin.worthe@entelect.co.za>
Thu, 17 Jul 2014 08:02:26 +0000 (10:02 +0200)
game/prefabs/player.js
game/states/play.js

index 3492836..98179d9 100644 (file)
@@ -25,10 +25,6 @@ Player.prototype.update = function() {
 };
 
 Player.prototype.move = function(newX, newY) {
-  if (this.moving || !this.isMyTurn) {
-    return;
-  }
-
   this.moving = true;
   var tween = this.game.add.tween(this).to({x: newX, y: newY}, 500);
   tween.onComplete.add(this.finishMovement, this);
index 104c322..e3009a5 100644 (file)
@@ -182,7 +182,7 @@ Play.prototype = {
     var newX = player.x + deltaX;
     var newY = player.y + deltaY;
 
-    if (!this.checkMap(newX, newY) && player.isMyTurn) {
+    if (!this.checkMap(newX, newY) && player.isMyTurn && !player.moving) {
       player.move(newX, newY);
       this.togglePlayerTurn();
     }