It’s ok when there’s 0 padding in imagesheet.
but when there’s padding>0 in imagesheet, strange flashing lines will appear when move the images.
I used to think it’s a bug of levelhelper api, but now I think it should be a bug of corona sdk, and I’ve submitted it to the bug system of coronalabs.
Test1: It’s ok when 0 padding
\_AH = display.actualContentHeight display.setDefault("background", 1, 1, 1, 1) local physics = require("physics") physics.start() physics.setGravity( 0, 10 ); local options = { frames = { { x = 0, y = 0, width = 200, height = 150, } }, sheetContentWidth = 200, sheetContentHeight = 150 } local sheetInfo = graphics.newImageSheet("road-0-padding.png", options) local layer = display.newGroup() local xStart = 0 for i = 1, 20 do local body = display.newImage(sheetInfo, 1) body:translate( 200 \* i, \_AH - 200 ) physics.addBody( body, "static", { density=3.0, friction=0.5, bounce=0.3 } ) layer:insert(body) end local function sign(value) if value \> 0 then return 1 elseif value \< 0 then return -1 else return 0 end end local delta = -20 timer.performWithDelay( 20, function(e) if layer.contentBounds.xMax \< display.contentCenterX then delta = math.abs(delta) elseif layer.contentBounds.xMin \> display.contentCenterX then delta = -math.abs(delta) end delta = sign(delta) \* math.random(1, 50) layer:translate( delta, 0 ) end, -1 )
Test2: It’s not ok when padding>0
display.setDefault("background", 1, 1, 1, 1) local physics = require("physics") physics.start() physics.setGravity( 0, 10 ); \_AH = display.actualContentHeight local options = { frames = { { x = 8, y = 8, width = 200, height = 150, } }, sheetContentWidth = 216, sheetContentHeight = 266 } local sheetInfo = graphics.newImageSheet("road-8-padding.png", options) local layer = display.newGroup() local xStart = 0 for i = 1, 20 do local body = display.newImage(sheetInfo, 1) body:translate( 200 \* i, \_AH - 200 ) physics.addBody( body, "static", { density=3.0, friction=0.5, bounce=0.3 } ) layer:insert(body) end local function sign(value) if value \> 0 then return 1 elseif value \< 0 then return -1 else return 0 end end local delta = -20 timer.performWithDelay( 20, function(e) if layer.contentBounds.xMax \< display.contentCenterX then delta = math.abs(delta) elseif layer.contentBounds.xMin \> display.contentCenterX then delta = -math.abs(delta) end delta = sign(delta) \* math.random(1, 50) layer:translate( delta, 0 ) end, -1 )