Giving up is easy
And you have here many ppl who can help you solve your problem so it makes no sense to give up
So
I did what you need and checked every aspect of it if it works and it does
Just to be clear event is combination of condition and action
You can have event without condition so it runs always
I have global structure variable with 3 children
HP PosX and PosY
HP of player is displayed in upper left in game
1 - At beginning of scene i am hiding DeathLayer (for you it will be layer with respawn button but since i am lazy i have only there text)
- I am loading here that global structure variable Saving
- You need these 2 events load and convert for it to properly load
2 - Because even so i have global variable HP set to 100 by default if save does not exist it sets it back to 0 that’s why this event check if it is 0 and if it is it sets is back to 100 (otherwise you would start game on death screen with 0 HP)
3 - Here i check if variable PosX and PosY are equal to 0 if they are (which means you did not make save YET same situation as above) i change position of player to default spawn point and center camera on him with trigger once so camera can catch up if you move
4 - Here i check if variable PosX and PosY are NOT equal to 0 if they are (which means you did create save file) i change player position to that variables
5 - If you collide with tree you gonna constantly lose 1 HP
6 - If your HP is 0 or less i show here death layer and delete player
7 - If layer is visible (meaning you died) and space key is pressed i hide death layer change HP back to 100 and again center camera on player
- Again same situation as in point 3 and 4 where i check if save exist or not just by checking if Pos variables are equal to 0 or not
8 - If they are 0 i move player to default spawn point
9 - If they are not 0 (meaning save with some position exist) i move player to that Pos variables
10 - If player is in collision with farmland (this is your checkpoint object) i save player X and Y positions to PosX and PosY variables
11 - Press X key to delete save file (it is just for testing)
12 - Press Z key to save on demand (normally you auto save when you die but if you want to test if HP is correctly saving for example drain your HP down to 70 then press Z to save then close and open game to see if HP will save then this is why it is there)
- Wherever you see Trigger once in condition it means it needs to be there and where you don’t see trigger once it means event needs to run WITHOUT it