Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Let's get our metal upgrade save data saving and loading
To and from the disc
Before we do still let's configure the directory
Where are Seaham fireworks
So let's go to project project settings
And under the application config section
If you don't see any of the settings go ahead and toggle on the advanced settings here
And we are going to use what called the custom user directory
And if you read this it says that it's going to save user data
To this day
Install Alex playing this more once we get into the actual saving but I didn't click that
To set a timer
And then give you a game and I'm just going to call it
2D survival
Course
Because that's what my project is called
Basically give
Input field whatever whatever folder you want your save data to existing in the user
And then walk around and close
Ok so I'm going to now go ahead and open up our meta progression see Nan
Subtitled by online-courses.club We compress knowledge for you!
That
File
And we want to save and load this as all the first thing we want to do is on ready we want
Load the data from the disk if it
Right
So let's create a new load data function
And actually in the car loads
File
That sounds better to me
Unless just right pass on here for now
Let's define a path for saved data so I'm going to up here create a constant variable called
Save file path
And that's going to be equal to in quote
User
Colon
4 / 4
And then whatever whatever you want to call the
What's a game that's
So what does the saying
This is a shorthand that could deal use
To point to the user directory on
The players device
Install for Windows this will be in the appdata directory
And I'm not sure what the other directories are on Mac and linux and mobile and all day
But there are designated areas in each of the systems for user data to be stored and Godot
Uses those under the hood
And when we configured in our project settings this custom user
This directory is going to be created
Inside of that
2-years ago
And then this file is going to be the file that were reading and writing to
So now we have the same file path defined let's do this
We're going to say yes
Not
File access dot file exist
Save file path
Just going to return
So saying is if the files are created yet that's fine I'll just use this default data here
Ok and that we're gonna read data is the following we need a grab a file
Am I going to save r file equals file access open
Open the save file path
And we're going to open it with file access
Reed
So that's telling us to open up that file for Reading
And then once we have that file we're going to say
Save underscore dealer is equal to
File
Underscore VR which stands forget variant
Insult that's going to
Get that variant which is going to be our dictionary
So we're going to store this dictionary in the file
And said that to see if the
So central was saying this is our default data for when we have no saved data
And
When the game is loaded or when the save files loaded will just replace that object with whatever is in the
Ok so now I'm ready
We want to do load saved
Just likes
So go ahead and Run the game
And make sure that everything works you shouldn't see any errors at all and if not everything is good to go
Alright son now the fun part let's go ahead and save the data so
Save
Save
And in here what we want to do
To save our file is equal to file access open
I'm going to do the same file path and in this time
We're going to do
File access
Because we're riding day
Sourcing open at file for writing
Never going to save file dad's store
Bar
I'm going to pass on this evening
Ok so it's really dad's
So you can see
Will taking the save data dictionary writing it to that file
And and
Loading it up here and
Assigning that save data back to that
Alright and that's it what just does few lines we've got
Loading and saving
Now one thing that we can do
To check if this is working
We can do this
So on experience Collective
Let's go ahead and just call Steve
After experience is collected every time
And then let's go home
Let's go and play
And then collect one experience while
Ok and then go ahead and close the game after you collect
Experience mi
And now that's remove that save
And then in the load save file function go ahead and print your saved
So print save data
And then Run the game
And look at your helper console and if it worked what you can see is that your metre upgrade currency is now set to
So that means that is were
I'm going to remove that print
And where is the save file actual
Add if you got a project
You can then click on the option open userdata file
And it will take you write 2
Where that file is when you can see in here
Look at the two dates of
Course
Direct
And then also our
James Avery
Which is right here
So that's where our game save actually is on the disk
And the final thing to do before we end this lesson
Call Steve at the
Red x
So what I'm going to do is I'm going to go to my
Arena time manager I'm going to open at
And in here in this group
When we
Put the end screen in place that introduces the fact that the user has
1
What we want to do is we want to call Safe so I'm going to go to my
M
Progression I'm going to call that save
Just like so
Let's go to main
E.ON player died Sydney
The other point
Which where showing the end screen
Let's call meta progression
Save there as well
This is doing essential
Whenever the player loses or winds were going to Save the Day
Alright so that's it for saving and loading
The next step is to make upgrades actually choosable by the player
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.