fallow camera 2D
-
how would i make the center of the screen be the players x y coordinates in a 2D game?
-
If you are using sprites you should be able to use
setSptiteCamera( player.x, player.y )
-
@pianofire is there any other way without sprites? id like to skip adding sprites until i get the basic game mechanic working properly
-
You can use
setModesetView(cameraX, cameraY, resX, resY) but I don't know if it brakes something.
Otherwise, just add cameraX and cameraY to the playerCoordinates when you draw it. -
@Jaywalker
setMode()
only accepts 2 parameters: width and height -
whoops, meant setView, thanks for pointing out @Martin
-
setView()
doesn't respect all drawing commands so may not be relied upon -
I hope it will help.
Correct me if it's wrong