Jump to content

How to reset a tilemap in Phaser3?


Recommended Posts

I feel like there should be a simple answer to this, but I've been unable to uncover anything so far.

I've created a tilemap, added a tileset image, and created a static layer. The map renders perfectly, yay.

I have "gate" tiles in my game which take the player to another world, by loading in another tilemap. I use the same process, and the map renders correctly again, woo.

The problem is that the original static layer was not destroyed, so the new map is imposed on top of the other. I am looking for a way to wipe the scene's tilemap between changing worlds.

I have looked for methods such as .reset() on the static layer, and the scene, but I haven't found anything so far. I don't want to fully restart the scene/game each time either, as that seems excessive, and would cause heavy (unnecessary) loading times. 

I feel that this would be such a common scenario, that I must be missing something really obvious, and I'd appreciate a gentle pointer in the right direction.

Thanks in advance :)


Link to comment
Share on other sites


  • Recently Browsing   0 members

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