local game = require 'game' local Camera = game.Object:extend() function Camera:use() local x, y = unpack(self.pos) local scale = 1 / self.scale local transform = love.math.newTransform( -x + 1920 / 2, -y + 1080 / 2, -self.rot, scale, scale) love.graphics.applyTransform(transform) end function Camera:follow(obj) self.following = obj end function Camera:update(dt) if self.following then self.pos[1] = self.following.pos[1] self.pos[2] = self.following.pos[2] end end return Camera