From 016c48ec3b6f2869bc0045816e28270b4c82e1fb Mon Sep 17 00:00:00 2001 From: logsol Date: Sat, 1 Oct 2016 14:01:12 +0200 Subject: [PATCH] During first worldUpdate set doll positions after spawning players Otherwise we get a warning. --- app/Game/Client/GameController.js | 8 ++++---- app/Game/Core/GameController.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Game/Client/GameController.js b/app/Game/Client/GameController.js index 0ae5778..8671e6f 100755 --- a/app/Game/Client/GameController.js +++ b/app/Game/Client/GameController.js @@ -78,10 +78,6 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque GameController.prototype.onClientReadyResponse = function(options) { var i; - if (options.worldUpdate) { - this.onWorldUpdate(options.worldUpdate); - } - if (options.runtimeItems) { for (i = 0; i < options.runtimeItems.length; i++) { @@ -107,6 +103,10 @@ function (Parent, Box2D, PhysicsEngine, ViewManager, PlayerController, Nc, reque } } + if (options.worldUpdate) { // needs to stay after onSpawnPlayer otherwise others doll will not be there + this.onWorldUpdate(options.worldUpdate); + } + //this.audioPlayer = new AudioPlayer(Settings.AUDIO_PATH + "city.mp3"); //this.audioPlayer.play(); }; diff --git a/app/Game/Core/GameController.js b/app/Game/Core/GameController.js index 04a4c6d..6210320 100755 --- a/app/Game/Core/GameController.js +++ b/app/Game/Core/GameController.js @@ -75,7 +75,7 @@ function (PhysicsEngine, TiledLevel, Player, Nc, Doll, GameObject, Item, Assert) var gameObject = this.worldUpdateObjects[uid]; if (!(gameObject instanceof GameObject)) { - console.warn('Cant find object ' + uid + ' in worldUpdateObjects pool'); + console.warn('Can\'t find object ' + uid + ' in worldUpdateObjects pool:', Object.keys(this.worldUpdateObjects)); continue; }