Created
July 12, 2015 20:26
-
-
Save zackproser/b35659cd2b61dfdc581e to your computer and use it in GitHub Desktop.
An example of initializing a custom game save system while setting up a Phaser game level.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////// | |
//READ LOCAL STORAGE | |
////////////////////// | |
this.playerStats; | |
if (localStorage.getItem('Canyon_Runner_9282733_playerStats') != null) { | |
this.playerStats = JSON.parse(localStorage.getItem('Canyon_Runner_9282733_playerStats')); | |
} else { | |
this.playerStats = { topScore: 0, topTime: 0, returnPlayerToState: 'HowToPlay'}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment