Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed scale/rotation shift compensation for tiles
  • Loading branch information
pevzi committed Jan 28, 2015
1 parent 2e0cef8 commit d044c4c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions map.lua
Expand Up @@ -627,10 +627,21 @@ function Map:setSpriteBatches(layer)
ty = y * th + tile.offset.y

-- Compensation for scale/rotation shift
if tile.sx < 0 then tx = tx + tw end
if tile.sy < 0 then ty = ty + th end
if tile.r > 0 then tx = tx + tw end
if tile.r < 0 then ty = ty + th end
local compx = 0
local compy = 0
if tile.sx < 0 then compx = tw end
if tile.sy < 0 then compy = th end

if tile.r > 0 then
tx = tx + th - compy
ty = ty + th - tw + compx
elseif tile.r < 0 then
tx = tx + compy
ty = ty + th - compx
else
tx = tx + compx
ty = ty + compy
end
elseif self.orientation == "isometric" then
tx = (x - y) * (tw / 2) + tile.offset.x + layer.width * tw / 2
ty = (x + y) * (th / 2) + tile.offset.y
Expand Down

0 comments on commit d044c4c

Please sign in to comment.