Extract a shared endRun helper for the game-over handoff

Offen
#39 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
57/100
Issue-Typ
Refactoring
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
game-dev

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
TypeScript
Sterne
3
Forks
3
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/GH-Arcade

Alle Issues in TMHSDigital/GH-Arcade

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.