-4

I am trying to make a game with Java using the slick library. Right now I have it so that the map moves and the character stands still, so it looks like the character is moving. But I have realized that this is deficient. I need to know how to make the camera move around with the character so he doesn't just fall off the screen. sorry I cant show you my code, I don't even know where to start. Does anyone know how to do this?

njzk2
  • 38,969
  • 7
  • 69
  • 107
user3558075
  • 29
  • 1
  • 5
  • What have you tried... we have none of your code. You can't expect us to just write code for you. We can't help without more information. – Walls May 12 '14 at 19:22
  • Now I've only done one application in Slick2D, but I don't recall there being a Camera Entity. You will likely just have to do geometric transformations – EyeOfTheHawks May 12 '14 at 21:47

1 Answers1

0

Translate the camera before rendering:

// in render():

g.translate(-cameraX,-cameraY);
renderObjects();
Anubian Noob
  • 13,426
  • 6
  • 53
  • 75