Extract a shared endRun helper for the game-over handoff

Aperta
#39 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
57/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
game-dev

Direzione di ricerca

Start with shared/scenes.ts and shared/pause.ts, then inspect the listed GameScene.ts examples and locate the other game-over call sites. Trace how each game guards the end of a run and builds restart data; migrate the ten games to the typed helper and run npm run typecheck and npm run build. Done when all ten use the helper and both checks pass.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

severity: low tech-debt

Summary

Every game repeats the same end-of-run code: set a private "over" flag, wait, then scene.start('GameOver', { gameId, score, ... }) with an unchecked object literal.

Where

  • shared/scenes.ts:72-79 (GameOverData is exported but imported by no game)
  • For example games/astro/scenes/GameScene.ts:486-490, games/breakout/scenes/GameScene.ts:432-441, games/siege/scenes/GameScene.ts:541-547, games/stack/scenes/GameScene.ts:447-453

Details

  • The payload is untyped at all ten call sites, so a misspelled field compiles.
  • The "over" flag has five spellings (over, levelDone, alive, phase === 'over', state === 'over'), and only Siege guards against a double call.
  • Restart data is stated twice per game, once for the pause menu and once for game over.
  • Scene keys are bare strings in the shared modules and every scene constructor.

Suggested fix

  1. Add endRun(scene, data: GameOverData, delayMs) to shared/scenes.ts with a once-only guard, and export scene-key constants.
  2. Migrate one game per commit.
  3. Let PauseController and endRun read restart data from one place.

Acceptance criteria

  • All ten games end a run through one typed helper

Getting started

  • Relevant files: shared/scenes.ts, shared/pause.ts, games/*/scenes/GameScene.ts
  • Run locally: npm install, then npm run dev
  • Checks: npm run typecheck and npm run build (there is no test suite yet)
  • Related docs: README.md

Filed by repo-audit/full-audit at b001f5d. Severity: low. Effort: M. audit-key: tech-debt|shared/scenes.ts|GameOverData

Lingua principale
TypeScript
Stelle
3
Fork
3
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/GH-Arcade

Tutte le issue di TMHSDigital/GH-Arcade

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.