so my game has many levels but i want a levels sheet so you can pick one but how can i make them all locked and unlock after the one before is complete and remember the levels unlocked when they restart the game
Develop games in your browser. Powerful, performant & highly capable.
You can use a single global variable (default value 1) which you store via webstorage. When the player completed a level, it will unlock the next one. Meaning that 1 will be added to the variable.
Now in the level selection screen, you only allow to go to levels which are lower or equal to that variable's value. How this is actually achieved depends on the style of your level selection. If you had clickable tiles representing a level you could add an instance variable called "level" which would represent the level number obviously. Now you could compare this easily to the unlock variable.
Remember to store the variable in local storage with the webstorage object to keep the progress saved.