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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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