How to add this to my game?

Hello i hope you are having an amazing day i need help with two things in my game
let me explain what i am doing first so i am making a game where you see a picture and you need to type what you see in a input form and every level has its own html and js file and i want to know first how to save progress lets say the player reahced level 5 and exits the game and rejoins and when he is on the home menu to not start from level 1 but to continue from level 5 the second thing is i dont want the player to see the levels they answered before.
thanks for visiting my Topic :slight_smile:

Hello @Svetlin_Pavlov, there are tons of ways to save data for user actually
If these woulld be temp data you could have use localStorage, or you could have use a database for each data that you want to save.
There are cloud services that could you use like firebase which its free for small usages i guess.
And if you are gonna wrap your game as an “app” i believe you could also use localStorage for this too. (Not an expert on this :slight_smile: )

For the level’s that player has been answered before, it’s same again, just get the data from your Storage (what ever you are gonna use), and then make a scene for it maybe would work :slight_smile:

I’ve created a working level select screen in Phaser v2, which uses window.localStorage.getItem and window.localStorage.setItem to load and store the solved levels.

See code example here: Github Phaser level select. It uses an array to hold the solved-value for each level, but you could also just store one single value to only keep track of the highest reached level. So when the player solves a level do something like window.localStorage.setItem('reachedlevel', this.currentlevel);.

Another thing, I wouldn’t recommend using separate .html and .js files for each different level. Instead I would use one data object or data .JSON file to store the levels in some way. In most games each level is basically the same game, except the only differences are the background layout, or the enemies, words, time limit etc. For more on this, see this post on the old forum.

2 Likes