Moved game loop from main.lua to specific script, sliced it into parts

This commit is contained in:
lustlion
2022-01-18 13:53:58 +01:00
parent d0e849bf3d
commit 0b18fcd369
5 changed files with 103 additions and 74 deletions

View File

@@ -4,7 +4,7 @@ Camera = {
height = 0
}
function Camera:CenterAt(x,y,cx,cy)
function Camera:positionCenterAt(x,y,cx,cy)
self.pos.x = x-self.width/game.scale/2
self.pos.y = y-self.height/game.scale/2
if not (cx == nil or cy == nil) then
@@ -19,7 +19,7 @@ function Camera:CenterAt(x,y,cx,cy)
self.pos.y = math.floor(self.pos.y)
end
function Camera:ScreenAt(x,y)
function Camera:positionAt(x,y)
self.pos.x = math.floor(x/self.width)*self.width
self.pos.y = math.floor(y/self.height)*self.height
end