Jump to content

Tilemap edge display when moving


Recommended Posts

I'm loading up a tilemap with 64x64 tiles and moving a sprite around in it.  That all seems to work well, but when moving in a way that would scroll the tilemap I get what looks like 32px of background briefly visible before it is drawn over.

If I set the layer to larger than the canvas size it will solve it in positive directions, but it persists when moving left or up.


Demo is here:



What am I doing wrong?

Link to comment
Share on other sites

  • 4 weeks later...

Here's what I'm doing right now which is really hacky.

  • I've gone back to using this.game.camera.follow() to get the Tilemaps synchronized with my Sprite groups
  • I've increased the game size and tilemap layer sizes to an additional 64 width and 64 height to accommodate a one-tile padding around the world
  • I've made the outer-edge tiles collidable with everything
  • I've put a DIV around the canvas with:
    • width: 864px;
    • height: 664px;
    • margin: -32px 0 0 -32px;
  • I've then put a DIV around that DIV with:
    • width: 800px;
    • height: 600px;
    • overflow: hidden;

Now there is no jarring edge lag on the Tilemap AND the Sprite Groups are synchronized with the Tilemap.


Of course, I would like a legitimate solution for this issue... Thanks!

Link to comment
Share on other sites


  • Recently Browsing   0 members

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