||Topic was automatically imported from the old Question2Answer platform.
i have been trying all day to save and load data so that exiting the game does not take you back to level 1 by my code does not work anyone can help?
And what is this code supposed to do ? THere are two functions here, one saves integer to a file, another read it from file. There is no function to actually use loaded variable to update your openlevs var.
What should i in this case then?
kitsune | 2022-01-07 10:49
How do make a function that loads the data?
kitsune | 2022-01-07 12:52
This code looks fine. The only issue is that you’re sending “data” in as an argument and as a member variable (there will be a warning about this in the console): remove the
var data = openlevs line.
You just need to call your methods. Let’s say you want to save when you press F5 and load when the game starts.
openlevs = load_val()
Go to project → project settings → input map (tab)
Enter save_level into “action field”, click add. Find “save_level” at the bottom of list, click “+”, then “key” and press F5.
Thank you! I am very grateful
I have been trying for 3 days now.
You saved me(no pun intended)
May god bless you
kitsune | 2022-01-07 13:47