Hi guys,
I have bulit a little function for my game that shows a ‘start screen’ before the game starts.
After implementing the function, the memory usage is about 120kB higher then without the function. (I imagine the performance is also worse)
Is that normal or do I have a menory leak?
Here is the function:
function StartScreen() --vis = true local highsore = GetHighscore() local SS = display.newGroup( ) local clouds = display.newImage(SS, "StartScreen/clouds.png", ScreenW/4, 400 ) local head = display.newImage(SS, "StartScreen/head\_ed.png", ScreenW/4, 200 ) local ground = display.newImage(SS, "StartScreen/ground.png", ScreenW/4, ScreenH-100 ) local cat = display.newImage(SS, "StartScreen/cat.png", ScreenW/4+200, ScreenH-350 ) local bird = display.newImage(SS, "StartScreen/bird.png", ScreenW/4-200, ScreenH/2-100 ) local highsoreText = display.newBitmapText(SS, "Highscore: ".. highsore, 50, ScreenH - 500, "23/font", 35 ) local rankText = display.newBitmapText( SS, "Rank: - ", 50, ScreenH - 425, "23/font", 40 ) highsoreText:setAnchor(0,0.5) rankText:setAnchor(0,0.5) local Button1 local B1image local Button2 local B2image local function handleButtonEvent( event ) if ( "ended" == event.phase ) then vis = false SS:removeSelf( ) SS= nil GameStart() end end local function handleButtonEvent2( event ) if ( "ended" == event.phase ) then showLeaderboards( event ) end end local BH = 80 local B1x = 160 local B2x = 350 local B1y = ScreenH - 250 -- Create the widget Button1 = widget.newButton( { x = B1x, y = B1y, shape = "circle", radius = 55, defaultFile = "play.png", fillColor = { default={RGB(240,135,0)}, over={RGB(240,135,0)}}, strokeColor = { default={0,0,0}, over={0,0,0} }, strokeWidth = 4, onEvent = handleButtonEvent } ) SS:insert(Button1) Button2 = widget.newButton( { x = B2x, y = B1y, shape = "circle", radius = 55, defaultFile = "play.png", fillColor = { default={RGB(240,135,0)}, over={1,0.1,0.7,0.4} }, strokeColor = { default={0,0,0}, over={0,0,0} }, strokeWidth = 4, onEvent = handleButtonEvent2 } ) SS:insert(Button2) B1image = display.newImage(SS,"play.png" , B1x, B1y) B1image:scale( 0.8, 0.8 ) B2image = display.newImage(SS, "list2.png" , B2x, B1y) B2image:scale( 0.8, 0.8 ) B1image:toFront( ) --GetRankGPGS(SS, 7) end