Skip to content

Commit

Permalink
I know there has to be a better way of accessing the metadata for a l…
Browse files Browse the repository at this point in the history
…ove2d

sprite batch but for now this will fix it. I am wasting another 16 bytes of
data per object/tile overall. I think that I might be able to do something
like batch[id].sx and batch[id].sy to get th metadata but that's up for
a later release once I am done with this one as I am not going to fix something
that is currently already working.

Fixes issue karai17#241
  • Loading branch information
133794m3r committed Oct 4, 2020
1 parent 50ef76c commit 38fa70a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sti/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,9 @@ function Map:setObjectSpriteBatches(layer)
x = tileX,
y = tileY - oy,
r = tileR,
oy = oy
oy = oy,
sx = tile.sx * sx,
sy = tile.sy * sy
}

self.tileInstances[tile.gid] = self.tileInstances[tile.gid] or {}
Expand Down Expand Up @@ -800,7 +802,7 @@ function Map:update(dt)
if update and self.tileInstances[tile.gid] then
for _, j in pairs(self.tileInstances[tile.gid]) do
local t = self.tiles[tonumber(tile.animation[tile.frame].tileid) + self.tilesets[tile.tileset].firstgid]
j.batch:set(j.id, t.quad, j.x, j.y, j.r, tile.sx, tile.sy, 0, j.oy)
j.batch:set(j.id, t.quad, j.x, j.y, j.r, j.sx, j.sy, 0, j.oy)
end
end
end
Expand Down

0 comments on commit 38fa70a

Please sign in to comment.