I also have a question about custom objects. I use lots of custom objects and the gamescene can be restarted a couple of times, for different levels or after game over.
Will the custom objects be properly destroyed and removed from memory? I know JavaScript has automatic garbage collection, but if you do something like this:
// add 50 balls
for (var i=0; i < 50; i++) {
var ball = new Ball(this, this.game.config.width/6, this.game.config.height/2, 'ball')
this.ballGroup.add(ball)
};
The custom Ball objects created with new are added to both the scene AND the ballGroup. So will they be destroyed and removed from memory when the scene is restarted? Or are they still referenced by the scene causing some sort of memory leak?