[SOLVED]Saving and loading/ checkpoint

Hi Zayddah,

As promised, I looked over my game file. I made a new update in my old thread with more details in the link below. It’s the long one at the bottom with all the screenshots. However, I should tell you that this is a general guide and it may not help with everything.

One thing I’ll say here is that I agree with Zero’s last post just above. Instead of having three Save actions, make a Parent Global Variable and then a few Child global variables (health, positions, etc,) under the parent, then have your programming revolve around saving the data from the Parent variables (which includes the data on the Child variables). My new post on my thread touches on that, I believe in the Player Extension part.

1 Like

hi the only thing that i can say. “This Is Hard asf” my mind is not working anymore.
and as you said before the multi scene idea is hard for me now. im giving up on that idea cuz its blowing my mind for now i want just to make a Save/Load Checkpoint System In this system, colliding with a new checkpoint will delete the previous save and save the new one. with the posibility of saving the player’s health thats it and if u think that i didnt try i swear it has been 7h straight that im working on this but still it didnt work i tried different method but it doesnt work. and for @Jules-Mado-Games method for me it’s a bit hard so i cant do it . if no one want to help i understand it i know that i am so annoying :smile: :smile:

1 Like

That’s alright if you wanna step away from this part of programming for now. I only started learning about storage, saving, and loading around… a year or so after I started using GDevelop. Even now, I’m still learning. I needed a lotta help, too.

Best of luck with your game and I’m sorry we couldn’t be much help. :sweat_smile:

I’m sure the more you use the software and learn new techniques, things will start to get easier to understand.

2 Likes

Thank you man you did a lot :heart:

1 Like

You’re welcome.

I don’t know if you read through my whole thread you’ve been using to help you with this or read the last couple of posts, but I recommend skimming through the rest of it. I remember at one point making a post where I declared that I was giving up. I thought about deleting those posts because they make the thread really long, but I decided not to because maybe the people who are also struggling with programming would read those parts and feel a little better knowing that they weren’t alone with the struggle. XD

XD. I’ma do it right now and see if I get it work I’ma try more than my best :heart::muscle:t3:

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

  • Then i perform a save

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
1 Like

To be Honest man i dont know how To thank You .the way you explain things made feel stupid i swear :sweat_smile: :sweat_smile: .
so for the other things like coins and stuff i should the same thing because now its clear i can do my work now i kinda understand now how the Storage System works because of you
and not to forget about @Drona and @Jules-Mado-Games that helped too thank you so much

1 Like

For coins you use Instance variables and give each coin ID variable
Create new topic titled
How to make/use Instance Variables
Again this is ultra easy but someone needs to explain to it
On other hand i bet you can find it just by using search option in upper right of this page

So maybe 1st search and make topic if something still is unclear for you

As for coins again do not delete just hide
But you will need to keep track of which coins are hidden and which are not

On top of that i think you will also dive into arrays for coins and that type of variable i did not explore but i bet it is stupidly easy as other variables

General idea is
You want to create events that will automatically give Instance variables to each coin and that i know how to do
But next you want to put them in array (idk if structure variable can do it cause i never did it again use search feature)
And so you would then prepare event that would check if coin is hidden or not or if its opacity is 225 or 0 and save that to variable

Some learning ahead of you but as you see everything is doable if are determinated
When you master instance variables you will have knowledge to switch check points into activated or not

For example you can have 3 animations for each checkpoint

  • untouched
  • already activated
  • your current checkpoint to which you will go back after respawn

THX to instance variables
On top of that not in like my example you would teleport to position of player where you collided with checkopint
You could set player to always spawn like left from or right from or on center of checkpoint you can even adjust how far or close to whatever position of checkpoint
Which would look more elegant and made a lot more sense

I seen you on gdevelop discord
You think i am some kind of smartass that know all that crap out of air?
In upper right of gdevelop discord type ZeroX4
find all my messages and sort by oldest
Go trough like 2 or 3 pages of my oldest and look how i was literally asking after someone told me what to do
But where is that? Where do i click? What is event block?
It is all there
We all started somewhere do not feel shame in asking for help and do not feel bad because you don’t know something
You are here to learn and there is no other way to achieve what you want other than learning

one last thing i want to know before i go is how can i set the animation of the checkpoint like when the player is onclission with it like in the photos



the problem is when the player collide with it they both activate like this
2

here to test out :

use F: to enter Houses

Thank you so much i really appreciate your help you have done a lot for me :heart:

1 Like

Player is in collision with object
Change animation of checkpoint
BUT my method does not save animation of checkpoint
Like i siad in previous post you will need for that instance variables to save that animation

My method will work for changing animation as long as you don’t close the game

1 Like

ah ok i get it thank you. :heart: