Jump to content

Tilemap gets clipped


Recommended Posts

Hello all,

if i display a tilemap and then move the camera the tilemap gets clipped.

When i first load the tilemap everything is rendered properly (red border is the canvas size)



but then when i move the camera a bit it looks like this



The tilemap is still in the canvas but it doesn't get fully rendered. Here is also a modified example from Phaser.io to demonstrate that problem:
just draw some tiles and then move the camera with the arrow keys

Any help would be appreciated. 

Link to comment
Share on other sites

  • 2 months later...

I think is the world bounds.

if you have a canvas W and H: 500 and you move your camera to 600, they crop your sprites bcs you are out of the world

you need set a world bounds

game.world.setBounds(0, 0, 600, 500);

so your camera is your canvas H and W but your world is much bigger: H 500 and W: 600


the red line is your camera in your exemple ;) 

now with setBounds you can move your camera (red line / canvas size ) + 100 to the right and no one is clipped 



Link to comment
Share on other sites


  • Recently Browsing   0 members

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