Game State
Beep8 includes a built-in game state system that automatically saves player progress and settings to the browser’s localStorage. This makes game data easy to manage, and allows players to close and continue their games without any extra setup.
beep8.State.clear([key])
Resets the state to its initial values. This is useful for starting a new game or resetting the application.
Parameters
- [key] (string): Optional localStorage key. (default: ‘beep8.state’)
beep8.State.init()
Sets default values for missing keys in the state. Does not overwrite existing values.
beep8.State.load()
Loads state from localStorage, replacing State.data.
beep8.State.save()
Saves the current state to localStorage using CBOR and base64.