hellspawn_bg Posted November 20, 2014 Report 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() { }}; 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.