Jump to content

How Can You End a Scene?


BryceJS
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...