Hi guys,
I’m having problems at a stage of my match 3 game. In the main class must eliminate the element of a table and carry out checks on the same table. For this reason I eliminate completely the item from the table (this element is a “candy” object). I would like to see an explosion effect to 'elimination of candy. as I said the class “Candy” is deleted immediately to perform controls so it can not be the effect. I was thinking of creating a module to be called to 'elimination of candy. This module would show only the burst effect.
However, I am finding memory leaks can help to plug the leaks?
if there are better ways to my logic let me know! enclose the code with memory loss.
Thanks and sorry for my bad English 
Candy class-------
local Candy = {} Candy.\_\_index = Candy function Candy.new(clr, dimCandy) local instance = { color = clr, image = display.newImageRect("images/candy/"..clr..".png",dimCandy,dimCandy), dL = dimCandy, movable = true, bloccante = "I", matchTestable = true, mark, punti = 20 } setmetatable(instance, Candy) return instance end function Candy:getDepth() return 2 end function Candy:whoIs() return "Candy" end function Candy:destroy() self.image:removeSelf() self.image = nil self.dL = nil self.color = nil self.movable = nil self.bloccante = nil self.matchTestable = nil self.mark = nil self.punti = nil end function Candy:destroyClass () Candy.new = nil Candy.getDepth = nil Candy.whoIs = nil Candy.destroy = nil Candy.destroyClass = nil Candy.\_\_index = nil Candy = nil end return Candy
—module for effect
local extra = {} function extra.prova(posX, posY) local posX = 400 local posY = 900 local dL = 80 local tempo = 1000 local function destroy( self ) transition.cancel(self.tmpLamp) self.tmpLamp:removeSelf() self.tmpLamp = nil transition.cancel(self.circle) self.circle:removeSelf( ) self.circle = nil for i = #self.stars,1,-1 do transition.cancel(self.stars[i]) self.stars[i]:removeSelf( ) self.stars[i] = nil end self.stars = nil self.nStars = nil self = nil destroy = nil end local animazione = {} animazione.stars = {} animazione.nStars = 10 animazione.tmpLamp = display.newImageRect("images/candy.png", dL, dL) animazione.tmpLamp.x = posX animazione.tmpLamp.y = posY transition.to( animazione.tmpLamp, {parms} ) animazione.circle = display.newImageRect("images/circle.png",0,0) animazione.circle.x = posX animazione.circle.y = posY transition.to( animazione.circle, {parms}) for i = 1, animazione.nStars do animazione.stars[i] = display.newImageRect("images/stella.png", dL\*0.20, dL\*0.20) animazione.stars[i].x = posX animazione.stars[i].y = posY transition.to( animazione.stars[i], {parms}) transition.to( animazione.stars[i], {parms}) end animazione.onComplete = destroy transition.to(animazione, {delay = tempo , time = 0, onComplete = animazione}) end return extra
main class
function foo () for i = 1, 100 do extra.prova(700,700) end end foo()
before cycle = MEMORY= 282.405 KB | TEXTURE= 0.01031494140625
after = MEMORY= 376.094 KB | TEXTURE= 0.01031494140625