Created
December 19, 2021 13:21
-
-
Save shohan4556/e61a71f7de3d655ae7c4677e082cfcb4 to your computer and use it in GitHub Desktop.
simple highscore
This file contains hidden or 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
// save score for the first time | |
if (localStorage.hasOwnProperty("score") == false) { | |
localStorage.setItem("score", this.SCORE); | |
} else { | |
const savedScore = localStorage.getItem("score"); | |
if (this.SCORE > savedScore) { | |
localStorage.setItem("score", this.SCORE); | |
} | |
} | |
this.scene.start("gameover", { currentScore: this.SCORE }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment