BryceJS Posted April 5, 2016 Share 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 Link to comment Share on other sites More sharing options...
OMAR Posted April 5, 2016 Share 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 Link to comment Share on other sites More sharing options...
Temechon Posted April 5, 2016 Share Posted April 5, 2016 scene.dispose() maybe ? http://doc.babylonjs.com/classes/2.3/Scene#dispose-rarr-void GameMonetize and OMAR 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.