I'm making a simple (for now) space game. There is nothing wrong with the gameplay itself. My problem now is with the camera:
1. I want it to follow the ship. I got it working, but I also want to zoom in/out it. I'm using love.graphics.scale for the zoom, and for the follow-player movement I'm using love.graphics.translate. But how can I make the camera zoom in/out centralized?
Code: Select all
local newx = ship.x+ship.size/2-scrW/2
local newy = ship.y+ship.size/2-scrH/2
love.graphics.scale(zoomfactor, zoomfactor)
love.graphics.translate(-newx+scrW*zoomfactor/scrW, -newy+scrH*zoomfactor/scrH)
2. I'm making it follow the ship by always having it in the center of the image. Is it a good method, or should I add an offset to the ship to move on the camera?
Thanks for the answers!