Jump to content

How do I use the tilemap destroy() method?


What?
 Share

Recommended Posts

Whenever I use it anywhere I get this error:

TypeError: this.game is null

How 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

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

 Share

  • Recently Browsing   0 members

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