Jump to content

Stage cleanup


hellspawn_bg
 Share

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

 Share

  • Recently Browsing   0 members

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