When the player is unable to play (dies)
When the player is unable to play (dies)
we trigger a game over state.
we trigger a game over state.
By calling a custom function in our
By calling a custom function in our
Player Script.
Player Script.
Add this code to the bottom of your Player Script
Add this code to the bottom of your Player Script
Check for Game Over by FALLING
Check for Game Over by FALLING
Check if your player is under the terrain.
Check if your player is under the terrain.
Drag your player the lowest position they can reach under your world.
Drag your player the lowest position they can reach under your world.
Check the Y position and use it in your code.
Check the Y position and use it in your code.
Add an if statement to the _physics_process function.
Add an if statement to the _physics_process function.
This checks the player’s Y position and if it is greater than your chosen value
This checks the player’s Y position and if it is greater than your chosen value
Call game_over.
Call game_over.
Change the background colour of the map
Change the background colour of the map
Go to Project Settings --> Environment --> Change Default Clear Colour
Go to Project Settings --> Environment --> Change Default Clear Colour