phpuserlogin Posted May 16, 2022 Share Posted May 16, 2022 Hello, I tried this code in a game, but doesn't do anything. if(score>highScore){ localStorage.setItem('highScore',score); var highScore=0, loc=localStorage.getItem('highScore'); if(loc>0)highScore=loc; The bottom would be added after var variables. And the top is for the Game over part of the game. ctx.fillText("High Score: "+HighScore,400,20); } This would go in a Function Check for Hits, at the very end Link to comment Share on other sites More sharing options...
dsonesuk Posted May 16, 2022 Share Posted May 16, 2022 'HighScore' is treated as a different variable compared to 'highScore' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now