daniel0514 Posted April 13, 2015 Share Posted April 13, 2015 hello everyone, I'm rather new in phaser and I'm having a hard time trying to figure this out... I'm working on a game with three levels (each as a different state), and what I want to do is that when the user wins the third level, the first level starts again (with some changes in speed and stuff like that to rise difficulty). i want it to happen until the user dies. A little graphic to explain it better: || level 1 || level 2 || level 3 (win) || level 1 (harder) || level 2 ( harder) || level 3 (harder) -> (dies) || menu what is the best approach to accomplish that? I hope anyone can help me sort this out. Link to comment Share on other sites More sharing options...
Noid Posted April 13, 2015 Share Posted April 13, 2015 You can use localStorage to save a variable holding a number. Each time the user wins the third level you increase that number. The code in each of the three states will read that variable and adjust difficulty accordingly. Link to comment Share on other sites More sharing options...
valueerror Posted April 14, 2015 Share Posted April 14, 2015 if you don't want the game to remember the last level state when you restart it then you could just use a global variable to store the current levelstate.. i'm using this to get the amount of "lives" my player collected from one state to another.. i just store it in the global scope. Link to comment Share on other sites More sharing options...
Pooya72 Posted April 15, 2015 Share Posted April 15, 2015 You can use localstorage as noid said or global variables as valueerror said and also you can use cookies to save level (set it by javascript at any time ) theese are all good options but if you want something more serious, you need to create a login system, store user level in database and save/load it by ajax ( may look confusing but its really simple) Link to comment Share on other sites More sharing options...
Recommended Posts