Skip to content

Commit cb8f2f9

Browse files
authored
Merge pull request #231 from dotellie/master
fix: tileInstances positioning for inifinite maps
2 parents 777df8f + 0023b81 commit cb8f2f9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

sti/init.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,9 @@ function Map:set_batches(layer, chunk)
500500
end
501501

502502
if self.orientation == "orthogonal" or self.orientation == "isometric" then
503+
local offsetX = chunk and chunk.x or 0
504+
local offsetY = chunk and chunk.y or 0
505+
503506
local startX = 1
504507
local startY = 1
505508
local endX = chunk and chunk.width or layer.width
@@ -529,7 +532,7 @@ function Map:set_batches(layer, chunk)
529532
end
530533

531534
if tile then
532-
self:addNewLayerTile(layer, chunk, tile, x, y)
535+
self:addNewLayerTile(layer, chunk, tile, x + offsetX, y + offsetY)
533536
end
534537
end
535538
end
@@ -866,7 +869,7 @@ function Map:drawTileLayer(layer)
866869
if layer.chunks then
867870
for _, chunk in ipairs(layer.chunks) do
868871
for _, batch in pairs(chunk.batches) do
869-
lg.draw(batch, floor(chunk.x * self.tilewidth), floor(chunk.y * self.tileheight))
872+
lg.draw(batch, 0, 0)
870873
end
871874
end
872875

0 commit comments

Comments
 (0)