BryceJS 0 Report post Posted April 5, 2016 Hello all, So I have been searching and I can't seem to figure this one out. I am trying to find out what the best way to end my game is? I can't seem to come across something such as scene.end() or something of that nature. What is the best practice for where I should put my winstate conditional in babylon.js? It seems like when I put it in my engine.runRenderLoop the game appears to freeze and I am unable to append anything to the page or break out of that runRenderLoop. Quote Share this post Link to post Share on other sites
OMAR 32 Report post Posted April 5, 2016 Hi @BryceJS! Well, the way I do it is split my game into "parts" and putting these parts inside corresponding functions like showMenu(), startGame(), endGame() etc. I also keep global variables to track what is going on for example var totalScore = 0 to keep scores or var isPlaying = false etc. Setting isPlaying to false at the end of the game can help you call other functions associated with behaviours that should happen when the player ends the game. Btw, engine.runRenderLoop() should always run, your freezing problem could be a bug. Perhaps you could provide a code snippet or something so we can see what could cause the freezing? Take care Quote Share this post Link to post Share on other sites
Temechon 677 Report post Posted April 5, 2016 scene.dispose() maybe ? http://doc.babylonjs.com/classes/2.3/Scene#dispose-rarr-void 2 Deltakosh and OMAR reacted to this Quote Share this post Link to post Share on other sites