From f523700dc4cb9b87db362827945a99402845d63b Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Fri, 23 Nov 2018 22:15:10 +0300 Subject: [PATCH] Wait for backgrounds to render before starting --- public/src/js/controller.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/public/src/js/controller.js b/public/src/js/controller.js index 69fbfd7..e7a8946 100644 --- a/public/src/js/controller.js +++ b/public/src/js/controller.js @@ -36,13 +36,15 @@ class Controller{ syncWith.game.startDate = this.game.startDate this.syncWith = syncWith } - this.startMainLoop() - if(!this.multiplayer){ - debugObj.controller = this - if(debugObj.debug){ - debugObj.debug.updateStatus() + requestAnimationFrame(() => { + this.startMainLoop() + if(!this.multiplayer){ + debugObj.controller = this + if(debugObj.debug){ + debugObj.debug.updateStatus() + } } - } + }) } startMainLoop(){ this.mainLoopStarted = false