Jump to content

Tilemap gets clipped


Cramer
 Share

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)

tilemap1.png.a60265be033eb483b75faa737d9400fb.png

 

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

tilemap2.png.0befb84d6338fd08a1409c5063b714de.png

 

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:
http://phaser.io/sandbox/sKmpqFwf
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 

 

tilemap1.png.a60265be033eb483b75faa737d9400fb.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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