diff --git a/app/Game/Client/GameController.js b/app/Game/Client/GameController.js index 33167ae..9cb1ca6 100755 --- a/app/Game/Client/GameController.js +++ b/app/Game/Client/GameController.js @@ -166,7 +166,6 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque var player = this.players[playerId]; player.spawn(x, y); - this.onGameObjectAdd('animated', player); if(options.holdingItemUid) { this.onHandActionResponse({ diff --git a/app/Game/Core/GameController.js b/app/Game/Core/GameController.js index 0a20439..e84747b 100755 --- a/app/Game/Core/GameController.js +++ b/app/Game/Core/GameController.js @@ -79,9 +79,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll) { console.warn("User (", userId ,") left who has not joined"); return; } - - this.onGameObjectRemove('animated', player); - + player.destroy(); delete this.players[userId]; } diff --git a/app/Game/Core/Player.js b/app/Game/Core/Player.js index 5575b76..9543c02 100755 --- a/app/Game/Core/Player.js +++ b/app/Game/Core/Player.js @@ -25,6 +25,8 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) { this.isSpawned = false; this.holdingItem = null; this.spectatorDoll = new SpectatorDoll(this.physicsEngine, "spectatorDoll-" + this.id, this); + + Nc.trigger(Nc.ns.core.game.gameObject.add, 'animated', this); } Player.prototype.getActiveDoll = function() { @@ -137,6 +139,9 @@ function (Doll, Settings, Nc, Exception, SpectatorDoll, RagDoll) { } Player.prototype.destroy = function () { + + Nc.trigger(Nc.ns.core.game.gameObject.remove, 'animated', this); + if(this.holdingItem) { this.throw(0, 0, this.holdingItem); }