diff options
author | Justin Worthe <justin.worthe@gmail.com> | 2014-08-23 12:18:34 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@gmail.com> | 2014-08-23 12:18:34 +0200 |
commit | 8c0a371916effa25ac77dc8a3420b95bd8b7a173 (patch) | |
tree | 8c0b17293d4289645da5a3399f36a811e698a1fd /game/prefabs/player.js | |
parent | 9f30e7581f4f4ea5aea06467daca3083f60e4714 (diff) |
Changed turn changing to only happen at the end of a players movement
Diffstat (limited to 'game/prefabs/player.js')
-rw-r--r-- | game/prefabs/player.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/game/prefabs/player.js b/game/prefabs/player.js index 344793b..40fce38 100644 --- a/game/prefabs/player.js +++ b/game/prefabs/player.js @@ -46,13 +46,19 @@ Player.prototype.update = function() { } }; -Player.prototype.move = function(newX, newY) { +Player.prototype.move = function(newX, newY, callback, callbackContext) { this.moving = true; var tween = this.game.add.tween(this).to({x: newX, y: newY}, 500); tween.onComplete.add(this.finishMovement, this); + tween.onComplete.add(callback, callbackContext); tween.start(); }; +Player.prototype.teleport = function(newX, newY) { + this.x = newX; + this.y = newY; +} + Player.prototype.finishMovement = function() { this.moving = false; }; |