I have managed to fix the death and respawn function. To do this, I looked for alternative sources and I found this tutorial on YouTube which provided a very simple solution for causing the character to die on contact with a certain object and then respawing at the beginning of the scene, which used box colliders and scripting (Unity, 2021).
Here is how the death/respawn function works in my game now.
The only thing it lack is that it is very automatic and does not allow for a particularly dramatic death. The player hits the spikes and is taken straight to the beginning of the level. It would be good to find a way to delay this process so that there can be a bit of death animation before the player returns to the beginning. Unlike Muddy Wolf Games’ solution (if it had worked for me), it also does not allow respawning in a new custom part of the map but rather wherever the sprite is already placed in the scene.
These are things I can explore further in future game projects.
References
bblakeyyy681, 2019. HOW TO KILL AND RESPAWN PLAYER-Unity Tutorial.
Unity Technologies. 2021. Unity (2021). [Software]
One Reply to “Rapid Ideation Session Day 14: Death and Respawn”