The basic idea is pretty simple..
You could either create the game over screen through events or create it on an layer set to invisible on start of layout.
Then when game over happens set the layer to visible or create the objects needed for it.
For the total distance you could just create a text object displaying it on the game over screen. Maybe it would be better to add a new global variable Highscore and set it to the total distance after the run if the distance is higher than the total distance of previous runs.