HI! I have finished my game, but when I got to the gameover´s screen I have a error…
there is the code of game and then I put the image of the error. Thx for the answers.
local storyboard = require ("storyboard")local scene = storyboard.newScene() local dianas = display.newGroup( ) local totalElementos = display.newGroup( ) local runtime = 0 local velocidad = 10 local tiempoGenerar = 1000 function scene:createScene(event) score = 0 fondo = display.newImageRect("fondoJuego.png", display.contentWidth, display.contentHeight) railIzq = display.newImageRect( "rail.png", 60, display.contentHeight) railDch = display.newImageRect( "rail.png", 60, display.contentHeight) fondo.x = display.contentWidth / 2 fondo.y = display.contentHeight / 2 railIzq.x = 75 railIzq.y = display.contentHeight/2 railDch.x = display.contentWidth -75 railDch.y = display.contentHeight/2 scoreTxt = display.newText( score, display.contentWidth/2, 50, native.systemFont, 40) scoreTxt:setFillColor( 0.9, 0.1, 0.1, 1) totalElementos:insert( fondo ) totalElementos:insert( railIzq ) totalElementos:insert( railDch ) totalElementos:insert( scoreTxt ) end function generar( event ) if (tiempoGenerar \> 200) then if (velocidad \< 22) then velocidad = velocidad + 1 end tiempoGenerar = tiempoGenerar - 100 end if (velocidad == 18 and tiempoGenerar == 200) then velocidad = 23 tiempoGenerar = 150 end print(velocidad) print(tiempoGenerar) local posX = math.random( 1 , 2 ) local posIzq = 75 local posDch = display.contentWidth - 75 if posX == 1 then diana = display.newImage( "diana.png" , posIzq , -100) diana:addEventListener( "touch", eliminarDiana ) else diana = display.newImage( "diana.png" , posDch , -100) diana:addEventListener( "touch", eliminarDiana ) end dianas:insert( diana )-- ERRRRRRRRRRRRRRRRROOOOOOOOOOOOOOOOOOOOOORRRRRRR LINE 51 (suguessing) totalElementos:insert( dianas ) dianas:toFront( ) scoreTxt:toFront( ) generarDianas = timer.performWithDelay( tiempoGenerar, generar, 1) end local generarDianas = timer.performWithDelay( 600, generar, 1) function getDeltaTime() local temp = system.getTimer() local dt = (temp- runtime) / (1000/30) runtime = temp return dt end function moverDianas( event ) local dt = getDeltaTime() for i = dianas.numChildren,1,-1 do if(dianas[i].y \> display.contentHeight + 200) then dianas:remove(dianas[i]) storyboard.gotoScene("gameOver", "fade", 600) else dianas[i].y = dianas[i].y + velocidad \* dt end end end Runtime:addEventListener("enterFrame", moverDianas ) function eliminarDiana( event ) if (event.phase == "began") then score = score + 1 scoreTxt.text = score event.target:removeSelf( ) end end function start(event) end function scene:enterScene(event) storyboard.purgeScene("menu") end function scene:exitScene(event) Runtime:removeEventListener("enterFrame", moverDianas) totalElementos:removeSelf( ) totalElementos = nil timer.cancel( generarDianas ) end function scene:destroyScene(event) end scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene