is there a way i can do it so as soon as my plane gets hit it goes to the game over screen as of now as i start my game the game over screen is on top of my images
function scene:create( event )
local sceneGroup = self.view
end
– “scene:show()”
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Called when the scene is still off screen (but is about to come on screen).
elseif ( phase == “did” ) then
– Called when the scene is now on screen.
end
end
– “scene:hide()”
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == “will” ) then
– Called when the scene is on screen (but is about to go off screen).
– Example: stop timers, stop animation, stop audio, etc.
elseif ( phase == “did” ) then
– Called immediately after scene goes off screen.
end
end
function scene:destroy( event )
removePlane()
removeSpike()
local sceneGroup = self.view
– Called prior to the removal of scene’s view (“sceneGroup”).
– Insert code here to clean up the scene.
– Example: remove display objects, save state, etc.
end
local options = {}
effect = “fade”
time = 500
composer.gotoScene(“gameover”)
– Listener setup
scene:addEventListener( “create”, scene )
scene:addEventListener( “show”, scene )
scene:addEventListener( “hide”, scene )
scene:addEventListener( “destroy”, scene )
return scene