Does anybody know how to code save data with blocks
Yeah! There’s an extension for this! Just go to the + extensions bar in your project and it will bring up a whole list of extensions that you can download by clicking on them.
Here’s what the extension looks like:
I hope this helps!
I dont know how to make it work
What kind of data are you trying to save? Can you post a link to your game?
Im triying to make it where if you click save, it saves your progress when you exit out.
So, the first step is to decide what state you want to save. Based on your game, it looks like your current state is:
- The player’s position (x and y)
- The health left in the status bar
- Whether or not the player has watched the opening cutscene
Now, let’s create two functions: saveState and restoreState:
In save state we write all of our state to settings. For the “watchedCutscene” true/false value we need to convert it to a number, so we’ll do 1 for true and 0 for false.
Now in our restore state function, we first check to see if our settings exist. If they don’t, there is no state for us to restore so we can just bail out using return. If the setting does exist, then we just do the exact opposite of what’s in our save state function.
Now that we have those functions defined, let’s call them in the game! restoreState will get called in the bottom of our on-start code:
Note that I added a little code to make sure the cutscene doesn’t play if the watchedCutscene variable is set to true!
…and save state gets called in the menu button handler:
One other quick tip: you might find the arcade-character-animations extension useful for animating your character! It will let you get rid of all of those button handlers you have
Ok. There may be bugs in the rpg.
That’s the Exact Save technique I did for my Voxel Edge Project! I’m surprised I did that right!