Skip to content

Stores

Stores are used to share data between vue components. Some stores need to share data between different routes. For this, we are using Pinia.

Game Store

The game store is responsible for storing the game state. It is updated by the game manager. This store is only used in the in-game view.

It has two loading states:

  • GameLoadingState: This state can either be Loading, LevelSelection, LevelRunning or Error.
  • LevelLoadingState: This state is used to wait until Phaser has loaded the tilemap and all the assets. It can either be Loading, Loaded or Error.

In addition, each loading state has a corresponding error message.

Saves Store

This store is storing the saves of the player in local storage. When hosting a game these saves are used to initialize the server's game state. While playing the game, the saves are updated regularly by the game manager. Every client is updating the saves not only the client that is hosting the game. This makes it possible that every client can host the game even if the player does not play with the original host.

Sound Store

The sound store is responsible for playing the sound effects and music in the menus. The sound in the levels is handled by a separate sound manager.