When I start level 61, I start experiencing a “leak” when I end the game and replay the current level or end the game and go to the next level. The leak shows up on my end game screen at the end of level 61. I do have a “preEndGame” where I am using composer to remove all the scene’s which helped eliminate memory leaks in levels 1-60.
The only “new” item between level 60 and 61 is the use of wind. So I am assuming the issue is the addition of wind. Below is my code.
Is there something I am not removing that I should be? Any thing I should do different?
Thanks - I appreciate the help
Lori
-----------------------------------------------------------------------------
– RETREIVE VENT FORCE VALUES
–the vents angle and desired power
–calculates and returns the proper xF and yF force values that is transferred to to floating objects
-----------------------------------------------------------------------------
local function getVentVals( angle, power )
local xF = math.cos( (angle-90)*(math.pi/180) ) * power
local yF = math.sin( (angle-90)*(math.pi/180) ) * power
return xF,yF
end
-----------------------------------------------------------------------------
– VENT COLLISION HANDLER
-----------------------------------------------------------------------------
local function ventCollide( self,event )
local vent = event.other
if ( event.phase == “began” and vent.isVent == true ) then
self.xF = self.xF+vent.xF ; self.yF = self.yF+vent.yF
elseif ( event.phase == “ended” and vent.isVent == true ) then
self.xF = self.xF-vent.xF ; self.yF = self.yF-vent.yF
end
end
-----------------------------------------------------------------------------
– RUNTIME FORCE APPLICATION
-----------------------------------------------------------------------------
local function constantForce1()
if not (tableBumper3.xF == 0 and tableBumper3.yF == 0 ) then
tableBumper3:applyForce(tableBumper3.xF,tableBumper3.yF,tableBumper3.x,tableBumper3.y )
end
end
local function constantForce2()
if not (tableBumper4.xF == 0 and tableBumper4.yF == 0 ) then
tableBumper4:applyForce(tableBumper4.xF,tableBumper4.yF,tableBumper4.x,tableBumper4.y )
end
end
-------------------------------------------------------
–VENT REMOVAL
-------------------------------------------------------
tableBumper3:removeEventListener( “collision”, tableBumper3)
Runtime:removeEventListener( “enterFrame”, constantForce1 )
tableBumper4:removeEventListener( “collision”, tableBumper4)
Runtime:removeEventListener( “enterFrame”, constantForce2 )
