From 41c0981eedf6933daeada7ece55234c0da525996 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Sun, 24 Aug 2014 11:48:17 +0200 Subject: Added dropping and eating of poison pills --- game/prefabs/player.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'game/prefabs/player.js') diff --git a/game/prefabs/player.js b/game/prefabs/player.js index fb63707..e1cdc60 100644 --- a/game/prefabs/player.js +++ b/game/prefabs/player.js @@ -19,6 +19,7 @@ var Player = function(game, x, y, key, frame, soundKey) { this.hasPoisonPill = true; this.poisonPillActive = false; + this.lastTween = null; this.scoreSound = game.sound.add(soundKey); @@ -54,6 +55,8 @@ Player.prototype.move = function(newX, newY, callback, callbackContext) { tween.onComplete.add(callback, callbackContext); tween.onComplete.add(this.finishMovement, this); + this.lastTween = tween; + tween.start(); }; @@ -77,6 +80,7 @@ Player.prototype.teleport = function(newX, newY) { Player.prototype.finishMovement = function() { this.moving = false; + this.lastTween = null; }; Player.prototype.getBounds = function() { -- cgit v1.2.3