diff --git a/sonic-radiance.love/core/modules/world/camera/init.lua b/sonic-radiance.love/core/modules/world/camera/init.lua index 49487ff..9a136c4 100644 --- a/sonic-radiance.love/core/modules/world/camera/init.lua +++ b/sonic-radiance.love/core/modules/world/camera/init.lua @@ -42,6 +42,9 @@ function CameraSystem:new(world) self.verticalSplit = SPLITSCREEN_ISVERTICAL self.targets = {} + self.xLocked = nil + self.yLocked = nil + self:initViews() end @@ -103,6 +106,23 @@ function CameraSystem:getViewPositions(id) end +function CameraSystem:lockX(x) + self.xLocked = x +end + +function CameraSystem:unlockX() + self.xLocked = nil +end + +function CameraSystem:lockY(y) + self.yLocked = y +end + +function CameraSystem:unlockY() + self.yLocked = nil +end + + -- WRAPPER and UTILS -- Access data from the views @@ -279,6 +299,14 @@ function CameraSystem:limitView(id) self.views.list[id].x = utils.math.between(posx, minx, maxx) self.views.list[id].y = utils.math.between(posy, miny, maxy) + + if (self.xLocked ~= nil) then + self.views.list[id].x = self.xLocked + end + + if (self.yLocked ~= nil) then + self.views.list[id].y = self.yLocked + end end -- UPDATE and MOVE functions