Discuss Scratch

reefrules5000
Scratcher
2 posts

how to code a game over screen?

i'm working on a game about swimming, and i'm trying to get the code to activate the game over screen when the health variable reaches zero. can anyone help with this?
Lowqal
Scratcher
2 posts

how to code a game over screen?

Hi, a simple gameover screen be achieved by always running a check for if the Health variable is below or equal to zero, then to show a sprite (your gameover screen).

In the gameover screen sprite:
whenclickedhideforeverifhealth=0or0>healththenshow

You might also want to have a “stop” block to make sure the game does not continue running in the background, and once the player has died they will need to click the green flag. You can also make a “try again” button.

Last edited by Lowqal (May 28, 2024 03:15:41)

reefrules5000
Scratcher
2 posts

how to code a game over screen?

thanks. i got it working.

Powered by DjangoBB