WASD or the arrow keys walk. Collect the gems and keep away from the beetles. Save the game in a slot, play on, then load it again (even after reloading the page).
| Slot 1 | |||
| Slot 2 | |||
| Slot 3 |
The engine's saveState turns the whole game in progress
into a string: the state object and everything in it, the
active sprites, the camera, and the logic mode. This demo keeps
it in the browser's localStorage, and
loadState puts it back. The beetles are objects of a
class of the game's own, and the gems are drawn by a renderer of
its own; both are named with addSaveName so they can be
saved. "Damage slot 1" spoils that slot's save, to show that
loading a bad save fails with a message and leaves the game as
it was.
See saveState, loadState, and addSaveName in the manual.