Platform: Windows
SDK: 1.11.1
Repro: Simulator and Device
I believe there's possibly a bug with the background not refreshing properly when moving multiple Sprites at once that partially overlap. In the video below, the piece is actually made up of 3 Sprites, and the background grid is drawn using setBackgroundDrawingCallback.
This "ghosting" only started happening when I added a short "bounce" animation after moving the piece, I think because when moving left, the Sprites will partially overlap for just a few frames. Without the bounce animation, this bug doesn't happen. It also doesn't happen when moving right, I think because the sprites are sorted R to L, so there is no partial overlap when moving that direction.
Apologies as this is hard to describe.
Expected behavior: Ghosting does not happen when moving pieces with the bounce animation.
Some code for the "nudge":
self.nudgeTimer = frameTimer.new(frames, 0, 1, easings.inOutCubic)
self.nudgeTimer.updateCallback = function()
for _, tile in pairs(self.tiles) do
tile.sprite:moveTo(tile.sprite.x - (pixelsPerFrame * cols), tile.sprite.y - (pixelsPerFrame * rows))
end
end
And nothing fancy for the BG:
gfx.sprite.setBackgroundDrawingCallback(
function(x, y, width, height)
-- Only draw the dirty part of the screen
gfx.setClipRect(x, y, width, height)
-- ... draw grid here ...
-- Reset when finished drawing
gfx.clearClipRect()
end
)