I'm creating a side scroller. Every time the player dies, a menu pops up, showing the match score and the best score. Then the player can restart the match and play again. In this moment, all global variables are reset to default values.
How can I add a death counter to the menu that pops up when the player dies?
Also, I'd like to store this value using LocalStorage, so it doesn't get lost when the game is restarted.