upload so it isnt lost now

This commit is contained in:
lustlion
2021-10-17 01:06:11 +02:00
commit 966aebf046
258 changed files with 2859 additions and 0 deletions

21
data/scripts/camera.lua Normal file
View File

@@ -0,0 +1,21 @@
Camera = {
pos = {x = 0, y = 0},
width = 0,
height = 0
}
function Camera:CenterAt(x,y,cx,cy)
self.pos.x = x-self.width/2
self.pos.y = y-self.height/2
if not (cx == nil or cy == nil) then
if self.pos.x < 0 then self.pos.x = 0 end
if self.pos.x > cx then self.pos.x = cx end
if self.pos.y < 0 then self.pos.y = 0 end
if self.pos.y > cy then self.pos.y = cy end
end
end
function Camera:ScreenAt(x,y,width,height)
self.pos.x = math.floor(x/width)*width
self.pos.y = math.floor(y/height)*height
end