how do I change the scoreboard to a list of images lke stars icon
please!!! heres my code
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() local physics = require "physics" local widget = require "widget" local movieclip = require ("movieclip") --add display objects local background local borderTop local borderBottom local cueball local shade local gameOverScreen local scoreText local pauseBtn local pauseBG local home local platform --Variables local gameIsActive = false local gameScore = 0 local screenW, screenH = display.contentWidth, display.contentHeight local viewableScreenW, viewableScreenH = display.viewableContentWidth, display.viewableContentHeight --Screen Size properties local ballBody = { density=0.8, friction=0.5, bounce=0.4, radius=15.0 } --audio sounds local saveValue = function( strFileName, strValue ) local theFile = strFilename local theValue = strValue local path = system.pathForFile( theFile, system.DocumentsDirectory ) local file io.open( path, "w+" ) if file then file:write( theValue ) io.close( file ) end end local loadValue = function( strFilename ) function scene:createScene( event ) local Group = self.view storyboard.removeScene( "loadgame" ) print( "\nmaingame: createScene event" ) end local theFile = strFilename local path = system.pathForFile( theFile, system.DocumentsDirectory ) local file io.open( path, "r" ) if file then local contents = file:read( "\*a" ) io.close( file ) return contents else file = io.open( path, "w" ) file:write( "0" ) io.close (file ) return "0" end end local setScore = function( scoreNum ) local newScore = scoreNum gameScore = newScore if gameScore \< 0 then gameScore = 0 end scoreText.text = "Score: " .. gameScore scoreText.xScale = 0.3; scoreText.yScale = 0.3 scoreText.x = 250 scoreText.y = 20 end -- add the callGameOver() function here??? why here??? -- ending game play -- have the Game Over sisplay screen pop up, display objects stop moving and event listeners deactivated -- add a sound notitidcaton to help triggerthe event local callGameOver = function() local gameOverGroup = display.newGroup() audio.play( gameOverSound ) gameIsActive = false physics.pause() pauseBtn.isVisible = false pauseBtn.isActive = false shade = display.newRect( 0, 0, 320, 480 ) shade:setFillColor( 0, 0, 0, 255 ) shade.x = 160; shade.y = 240 shade.alpha = 0 gameOverScreen = display.newImageRect( "gameOver.png", 400, 300 ) local newScore = gameScore setScore( newScore ) gameOverScreen.x = 170; gameOverScreen.y = 160 gameOverScreen.alpha = 0 gameOverGroup:insert( shade ) gameOverGroup:insert( gameOverScreen ) --TRANSITION GAME OVER ASSETS transition.to( shade, { time=200, alpha=0.65 } ) transition.to( gameOverScreen, { time=1000, alpha=1, xScale=1.2, yScale=1.2 } ) if gameScore \> highScore then highScore = gameScore local highScoreFilename = "highScore.data" saveValue( highScoreFilename, tostring(highScore) ) end highScoreText = display.newText( "Best Game Score: " .. tostring( highScore ), 0, 0, "Arial", 30 ) highScoreText:setTextColor( 255, 255, 255, 255 ) highScoreText.xScale = 0.5; highScoreText.yScale = 0.5 highScoreText.x = 160 highScoreText.y = 160 gameOverGroup:insert( highScoreText ) local function onMenuBtnRelease() --add sound here storyboard.gotoScene( "mainmenu", "fade", 500 ) end menuBtn = widget.newButton{ label="", labelColor = { default={255}, over={128} }, defaultFile="menubutt.png", overFile="menubuttover.png", width=100, height=40, onRelease = onMenuBtnRelease -- event listener function } menuBtn.x = 0 menuBtn.y = 400 btnAnim = transition.to( menuBtn, { time=2000, x=160, transition=easing.inOutExpo } ) gameOverGroup:insert( menuBtn ) scoreText.isVisible = false scoreText.text = "Score: " .. gameScore scoreText.xScale = 0.3; scoreText.yScale = 0.3 scoreText.x = 250 scoreText.y = 20 scoreText:toFront() timer.performWithDelay( 0, function() scoreText.isVisible = true; end, 1 ) end -- Shoot the cue ball, using a visible force vector local function cueShot( event ) local t = event.target local phase = event.phase if "began" == phase then display.getCurrentStage():setFocus( t ) t.isFocus = true t:setLinearVelocity( 0, 0 ) t.angularVelocity = 0 target.x = t.x target.y = t.y local startRotation = function() target.rotation = target.rotation + 2 end Runtime:addEventListener( "enterFrame", startRotation ) local showTarget = transition.to( target, { alpha=0.4, xScale=0.4, yScale=0.4, time=200 } ) myLine = nil elseif t.isFocus then if "moved" == phase then if ( myLine ) then myLine.parent:remove( myLine ) -- erase previous line, if any end myLine = display.newLine( t.x,t.y, event.x,event.y ) myLine:setColor( 255, 255, 255, 50 ) myLine.width = 14 elseif "ended" == phase or "cancelled" == phase then display.getCurrentStage():setFocus( nil ) t.isFocus = false local stopRotation = function() Runtime:removeEventListener( "enterFrame", startRotation ) end local hideTarget = transition.to( target, { alpha=0, xScale=1.0, yScale=1.0, time=200, onComplete=stopRotation } ) if ( myLine ) then myLine.parent:remove( myLine ) end local cueShot = audio.loadSound("cueShot.mp3") audio.play(cueShot) t:applyForce( (t.x - event.x), (t.y - event.y), t.x, t.y ) end end -- Stop further propagation of touch event return true end local onBackground = function() local gameGroup = display.newGroup() background = display.newImageRect( "background.png", 560, 560 ) background.x = 160; background.y = 240 gameGroup:insert( background ) platform = display.newImageRect( "shoot.png", 120, 20 ) platform.type = "platform" platform.x = 40; platform.y = 230 physics.addBody( platform, "static", { density=1.0, bounce=0.4, friction=0 } ) platform.isVisible = true gameGroup:insert( platform ) imageTable = {} for i = 1,6 do table.insert( imageTable, "house" .. i .. ".png" ) end house = movieclip.newAnim( imageTable ) house.x = 50 house.y = 50 house.xScale = 0.4 house.yScale = 0.4 house.isSensor = true physics.addBody( house, "static", { density=1.0, bounce=0.4, friction=0, radius=10 } ) house.isVisible = true house.type = "relax" gameGroup:insert( house ) house:reverse{ startFrame=6, endFrame=1, loop=0 } borderLeft = display.newRect( 0, 1, 1, 480 ) borderLeft:setFillColor( 0, 0, 0, 0) -- make invisible physics.addBody( borderLeft, "static", { density=1.0, bounce=0.4, friction=0 } ) gameGroup:insert( borderLeft ) borderRight = display.newRect( 319, 1, 1, 480 ) borderRight:setFillColor( 0, 0, 0, 0) -- make invisible physics.addBody( borderRight, "static", { density=1.0, bounce=0.4, friction=0 } ) gameGroup:insert( borderRight ) borderTop = display.newRect( 0, 0, 320, 1 ) borderTop:setFillColor( 0, 0, 0, 0) -- make invisible physics.addBody( borderTop, "static", { density=1.0, bounce=0.4, friction=0 } ) gameGroup:insert( borderTop ) borderBottom = display.newRect( 0, 479, 320, 1 ) borderBottom:setFillColor( 0, 0, 0, 0) -- make invisible physics.addBody( borderBottom, "static", { density=1.0, bounce=0.4, friction=0 } ) gameGroup:insert( borderBottom ) end function hud() local hudGroup = display.newGroup() local loveIcons = {} local loves = 3 local maxloves = 3 local i for i = 1, maxloves do loveIcons[i] = display.newImage( "loveicon.png" ) loveIcons[i].x = 210 + ( loveIcons[i].contentWidth\* (i - 1)) loveIcons[i].y = 20 loveIcons.isVisible = false loves = loves + 1 if gameScore \>= 500 then loves = maxloves end loveIcons.isVisible = false end -- add in text for the score and close the function scoreText = display.newText( "Score: ".. gameScore, 0, 0, "Arial", 45) scoreText:setTextColor( 255, 255, 255, 255 ) scoreText.xScale = 0.4; scoreText.yScale = 0.4 scoreText.x = 250 scoreText.y = 20 scoreText.isVisible = false hudGroup:insert( scoreText ) local function onPauseBtnRelease() if pauseBtn.isActive then --add sound here if gameIsActive then gameIsActive = false physics.pause() local function pauseGame() physics.pause() print("timer has been paused") end timer.performWithDelay(1, pauseGame) if not shade then shade = display.newRect( 0, 0, 320, 480 ) shade:setFillColor( 0, 0, 0, 255 ) shade.x = 160; shade.y = 240 end shade.alpha = 1.0 if pauseBG then pauseBG.isVisible = true pauseBG.isActive = true pauseBG:toFront() end pauseBtn:toFront() else if shade then display.remove( shade ) shade = nil end if pauseBG then pauseBG.isVisible = false pauseBG.isActive = false end gameIsActive = true physics.start() end end end pauseBtn = widget.newButton{ label="", labelColor = { default={255}, over={128} }, defaultFile="pauseBtn.png", overFile="pauseBtn\_over.png", width=74, height=40, onRelease = onPauseBtnRelease -- event listener function } pauseBtn.x = 297 pauseBtn.y = 60 hudGroup:insert( pauseBtn ) pauseBG = display.newImageRect( "creditsBG.png", 320, 480 ) pauseBG.x = 384; pauseBG.y = 240 pauseBG.isVisible = false pauseBG.isActive = false hudGroup:insert( pauseBG ) end function onCollision( self, event ) event.other:setLinearVelocity( 0, 0 ) if event.other.type == "white" then local fallDown = transition.to( event.other, { alpha=0, xScale=1.5, yScale=1.5, time=1000 } ) local newScore = gameScore + 500 setScore( newScore ) event.other:removeSelf() elseif event.other.type == "blush" then local fallDown = transition.to( event.other, { alpha=0, xScale=1.5, yScale=1.5, time=1000 } ) local newScore = gameScore + 500 setScore( newScore ) event.other:removeSelf() elseif event.other.type == "gush" then local fallDown = transition.to( event.other, { alpha=0, xScale=1.5, yScale=1.5, time=1000 } ) local newScore = gameScore + 500 setScore( newScore ) event.other:removeSelf() elseif event.other.type == "relax" and gameIsActive then local fallDown = transition.to( self, { alpha=0, xScale=0.3, yScale=0.3, time=800 } ) timer.performWithDelay( 100, callGameOver ) end end local ballProperties = function() local ballGroup = display.newGroup() --Create cueball cueball = display.newImageRect( "ball\_white.png",76, 40 ) cueball.x = 160; cueball.y = 383 physics.addBody( cueball, ballBody ) cueball.linearDamping = 0.3 cueball.angularDamping = 0.8 cueball.isBullet = true -- force continuous collision detection, to stop really fast shots from passing through other balls cueball.type = "cueball" cueball.collision = onCollision cueball:addEventListener("collision", cueball) -- Sprite balls start animation on Collision with cueball cueball.postCollision = ballCollisionAudio --Sets Event Listener for Audio on Collision cueball:addEventListener( "postCollision", cueball ) --Creat Rotating target target = display.newImage( "target.png" ) target.x = cueball.x; target.y = cueball.y; target.alpha = 0; shoot = display.newImageRect( "shoot.png", 100, 20 ) shoot.type = "shoot" shoot.x = 160; shoot.y = 460 physics.addBody( shoot, "static", { bounce=0, friction=9 } ) ----love A imageTable = {} for i = 1,6 do table.insert( imageTable, "love" .. i .. ".png" ) end loveA = movieclip.newAnim( imageTable ) ballGroup:insert( loveA ) loveA.x = 260 loveA.y = 325 loveA.xScale = 0.5 loveA.yScale = 0.5 loveA.type = "white" physics.addBody( loveA, "static", { density=1.0, bounce=0.4, friction=0, radius=30 } ) loveA.isSensor = true -- Start the animations loveA:reverse{ startFrame=6, endFrame=1, loop=0 } -----love B imageTable = {} for i = 1,6 do table.insert( imageTable, "love" .. i .. ".png" ) end loveB = movieclip.newAnim( imageTable ) ballGroup:insert( loveB ) loveB.x = 260 loveB.y = 225 loveB.xScale = 0.5 loveB.yScale = 0.5 loveB.type = "blush" physics.addBody( loveB, "static", { density=1.0, bounce=0.4, friction=0, radius=30 } ) loveB.isSensor = true -- Start the animations loveB:reverse{ startFrame=6, endFrame=1, loop=0 } ------love C imageTable = {} for i = 1,6 do table.insert( imageTable, "love" .. i .. ".png" ) end loveC = movieclip.newAnim( imageTable ) ballGroup:insert( loveC ) loveC.x = 160 loveC.y = 105 loveC.xScale = 0.5 loveC.yScale = 0.5 loveC.type = "gush" physics.addBody( loveC, "static", { density=1.0, bounce=0.4, friction=0, radius=30 } ) loveC.isSensor = true -- Start the animations loveC:reverse{ startFrame=6, endFrame=1, loop=0 } ballGroup:insert( shoot ) ballGroup:insert(cueball) cueball:addEventListener( "touch", cueShot ) -- Sets event listener to cueball end function scene:enterScene( event ) local gameGroup = self.view local gameActivate = function() pauseBtn.isVisible = true pauseBG.isActive = true gameIsActive = true end local gameStart = function() -- start the physics property and set the gravity for the falling eggs physics.start() physics.setScale( 50 ) physics.setGravity(0, 2) -- to make sure that your physical object boundaries for your display objects are in the right place -- use physics.setDrawMode("hybrid") physics.setDrawMode( "normal" ) -- Activate all the functions instantiated. -- Add an event listener for charObject using the "touch" for the moveChar function. onBackground() ballProperties() hud() gameActivate() local highScoreFilename = "highScore.data" local loadedHighScore = loadValue( highScoreFilename ) highScore = tonumber(loadedHighScore) end gameStart() print( "maingame: enterScene evnt" ) end function scene:exitScene() if myTimer then timer.cancel( myTimer ) end print( "loadgame: exitScene event" ) end function scene:destroyScene( event ) print( "((destroying loadgame's view))" ) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene