Hello the error happening after i out on menu
function scene:create( event )
local sceneGroup = self.view
physics.pause() -- Temporarily pause the physics engine
backGroup = display.newGroup() -- Display group for the background image
sceneGroup:insert( backGroup ) -- Insert into the scene's view group
mainGroup = display.newGroup() -- Display group for the ship, asteroids, lasers, etc.
sceneGroup:insert( mainGroup ) -- Insert into the scene's view group
uiGroup = display.newGroup() -- Display group for UI objects like the score
sceneGroup:insert( uiGroup ) -- Insert into the scene's view group
display.setStatusBar( display.HiddenStatusBar)
_W = display.contentWidth;
_H = display.contentHeight;
scrollSpeed = 1;
local bg1 = display.newImageRect( backGroup, "background.png", 800, 1400 )
bg1.x = display.contentCenterX
bg1.y = _H/2
local bg2 = display.newImageRect( backGroup, "background.png", 800, 1400 )
bg2.x = display.contentCenterX
bg2.y = bg1.y+1400
local bg3 = display.newImageRect( backGroup, "background.png", 800, 1400 )
bg3.x = display.contentCenterX
bg3.y = bg1.y+1400
local function move(bt)
bg1.y = bg1.y + scrollSpeed
bg2.y = bg2.y + scrollSpeed
bg3.y = bg3.y + scrollSpeed
if (bg1.y) >2100 then
bg1:translate( 0, -2800)
end
if (bg2.y) > 2100 then
bg2:translate( 0, -2800 )
end
if (bg3.y) > 2100 then
bg3:translate( 0, -2800 )
end
end
Runtime:addEventListener( "enterFrame", move )
ship = display.newImageRect( mainGroup, objectSheet, 4, 98, 79 )
ship.x = display.contentCenterX
ship.y = display.contentHeight - 100
physics.addBody( ship, { radius=30, isSensor=true } )
ship.myName = "ship"
-- Display lives and score
livesText = display.newText( uiGroup, "Lives: " .. lives, 200, 80, native.systemFont, 36 )
scoreText = display.newText( uiGroup, "Score: " .. score, 400, 80, native.systemFont, 36 )
local out = display.newImageRect( sceneGroup, "out.png", 50, 50, native.systemFont, 36 )
out:setFillColor( 0.82, 0.86, 1 )
out.x = 550
out.y = 85
out:addEventListener( "tap", endGame )
ship:addEventListener( "tap", fireLaser )
ship:addEventListener( "touch", dragShip )
explosionSound= audio.loadSound("audio/explosion.wav")
fireSound = audio.loadSound( "audio/fire.wav" )
musicTrack = audio.loadStream( "audio/80s-Space-Game_Looping.wav")
end