I'm creating a clicker browser game, and want to be able to save progress. I know about how to use local storage, but I'm wondering what the best methods for storing different objects, variables, and elements if they’ve been created.
I know how to use local storage, but what I’m trying to figure out is if there is a better way then just saying setItem for every single thing? And, then how would I deal with doing it with objects vs variables?
I was looking at the game a dark room’s GitHub to see how it was one there. I haven’t worked with jquery at all, but it seems like there is very little code to save info, and I don’t quite understand how it does it.
I’m trying to improve as a programmer, and instead of going through and “brute forcing” it, with lots of code, I’m trying to find better ways to write it-make it more efficient and not write the same function repeatedly.
I don’t have a snippet as it’s a lot of code, not looking for you to write the code obviously, just looking for methods of saving these different types of data better! Any help would be appreciated, thank you!