How to add this to my game?

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