display a game over message

Hi, I use a “char.png” image for the main character of my game.

how can I display a game over message and stop the game if “char.png” fall off the screen? I’ ve tried

_H = display.contentHeight

if(char.y \> \_H) then  
local text = display.newText("Game Over",0,0,native.systemFont, 70);  
end  

and

if(char.y \< \_H) then  
local text = display.newText("Game Over",0,0,native.systemFont, 70);  
end  

but it doesn’t work. Thanks for your help [import]uid: 76800 topic_id: 24818 reply_id: 324818[/import]

When it’s game over you will probably want to remove a lot of runtime events along with other stuff.

char.myName = "character"  
\_H.myName = "hblock"  
  
local function death( event )  
if event.phase == "began" then  
 if event.object1.myName == "character" and event.object2.myName == "hblock" then  
 event.object1:removeSelf()  
 event.object1 = nil  
 local text = display.newText("Game Over",0,0,native.systemFont, 70);  
 end  
end  
end  
Runtime:addEventListener( "collision", death )  
  

Try something like that and you can build your code from there
[import]uid: 77199 topic_id: 24818 reply_id: 100654[/import]