What? Posted December 16, 2014 Share Posted December 16, 2014 Whenever I use it anywhere I get this error:TypeError: this.game is nullHow do I use it properly? In the docs it says it nulls the game reference, but that's the point, right? I'm just using map.destroy(). "Map" is defined like this:map = this.game.add.tilemap('testLevel');EDIT:After success in another file, I'm guessing that the error is happening because something else is depending on the map to still exist, but I'm not sure. Link to comment Share on other sites More sharing options...
InsaneHero Posted December 17, 2014 Share Posted December 17, 2014 Try setting a breakpoint in the chrome debug browser (or your browser of choice, all the main ones will let you do this) just before the line where you get that error... then take a look at the 'call stack' to see where in the code the call came from. The chances are very likely that you're continuing to call something after it has been destroyed and this is the easiest way to track down those problems. Link to comment Share on other sites More sharing options...
Recommended Posts