bugfix collision optimizer being too greedy

This commit is contained in:
lustlion 2022-02-15 10:35:52 +01:00
parent 8def86ade6
commit 5f852a61e6
2 changed files with 4 additions and 8 deletions

View File

@ -301,7 +301,6 @@ function Player:HandleAnimation()
)
end
logPrint(tostring(self.body.anim_speed))
self.body:Animate()
self:Draw(self.body)

View File

@ -247,23 +247,18 @@ function TileOptimizeObjects()
logPrint("Optimizing Objects...")
local unoptimized = 0
local isTileOptimized = {}
for i = 1, #LevelTiles do
isTileOptimized[i] = {}
for j= 1, #LevelTiles[i] do
isTileOptimized[i][j] = false
end
end
for i = 1, #LevelTiles do
for j = 1, #LevelTiles[i] do
if LevelTiles[i][j].id ~= 0 then
local type = TileData[LevelTiles[i][j].id].type
if type == "whole" and not isTileOptimized[i][j] then
isTileOptimized[i][j] = true
local n = 1
local check = true
while check do
@ -281,12 +276,12 @@ function TileOptimizeObjects()
end
end
end
local m = 1
local check = true
while check do
check = false
local checkline = true
-- for as long as line, check
for l = 0, n-1 do
checkline = false
if LevelTiles[i+m] ~= nil
@ -301,6 +296,8 @@ function TileOptimizeObjects()
else
break
end
else
break
end
end
if checkline then
@ -310,7 +307,7 @@ function TileOptimizeObjects()
end
m = m + 1
else
check = false
break
end
end