Jump to content

Stage cleanup


Recommended Posts

I am wondering how to implement the stage cleanup when switching between 'Game' and 'GameOver' stage. Should I simply put this = null in the shutdown function or should I nullify all the objects created in the stage. I have alot of objects and vars created in my stage and I want to avoid memory leaks when switching stages.

Game = function(game) {    ....    //hell of alot vars defined here};Game.prototype = {    create: function() {        this.obj1 = new Obj1();        this.obj2 = new Obj2();        ....    },    gameOver: function() {         // Switch to game over stage         this.stage.start('GameOver');    },    shutdown: function() {    }};
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.

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.


  • Recently Browsing   0 members

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