Skip to content

Instantly share code, notes, and snippets.

@Rafe
Created October 15, 2022 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rafe/e178d8534f35a707e33868183b134616 to your computer and use it in GitHub Desktop.
Save Rafe/e178d8534f35a707e33868183b134616 to your computer and use it in GitHub Desktop.
Tetris store
const useGame<State>((set, get) => ({
gameState: GameState.START,
level: 1,
line: 0,
score: 0,
matrix: buildMatrix(),
currentPiece: createCurrentPiece(generatePieceType()),
nextPieceType: generatePieceType(),
gameLoop() {
...
},
controller: ({
...
})
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment