Hello, I’m trying to make the camera clamp so it doesn’t go outside the tiled map, although the scaling of the map rendering is interfering and I’m not sure what else to try.
Render code
public void render(GameContainer gc, Graphics grphcs) throws SlickException {
grphcs.scale(scale, scale);
map.render((int) -camera.x, (int) -camera.y, 0);
}
Portion of the update code to clamp the camera
float w = ((map.getTileWidth()) * map.getWidth());
if (camera.x > w) {
camera.set(w, camera.y);
}
I’m using Slick2D if that has any relevance. Thanks for reading.