hellspawn_bg Posted November 20, 2014 Share Posted November 20, 2014 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 More sharing options...
Recommended Posts