I made 2 modifications to your js.lua file and got it to work…
Here’s the section I modified…
if image == "circle" then
part[plus][multi] = display.newCircle( posX + posOffsetX, posY + posOffsetY, imgSize )
partGroup:insert( part[plus][multi] )
part[plus][multi].strokeWidth = stroke
part[plus][multi].alpha = startAlpha
part[plus][multi]:setStrokeColor( strokeRed, strokeGreen, strokeBlue )
part[plus][multi]:setFillColor( fillRed, fillGreen, fillBlue, fillAlpha )
newDirX = part[plus][multi].x + dirX
newDirY = part[plus][multi].y + dirY
local transA = transition.to( part[plus][multi], { time = showTime - dirSpeed, alpha = endAlpha, x = newDirX, y = newDirY, onComplete = function(event)
display.remove(part[plus][multi])
part[plus][multi] = nil
transA = nil
end} )
if layer then layer:insert( partGroup ) end
if partGroup.numChildren \> imgMaxCount then
repeat
partGroup:remove(1)
until partGroup.numChildren \< imgMaxCount/2
end
end
The changes I made:
Notice line 3 above - I always like to add display objects into their group right away so I move this lie up
Notice line 13 above - I think you are running into conflicting operations removing display objects, by changing this to display.remove it will check to make sure it is not already been nil’d
The second bullet highlights a great practice by Beebe that I have shifted to in all my display object removals. Read this if you haven’t seen it yet: Corona SDK Memory Leak Prevention 101
Hope that helps, good luck!
–Croisened
[import]uid: 48203 topic_id: 14985 reply_id: 55404[/import]