Repository navigation
Description
Summary
The roadmap lists a Breakout level editor, with no issue tracking it. Breakout's levels are already plain text grids, so the game is most of the way to supporting player-made levels; what is missing is a way to load a level that is not compiled in, and a screen to draw one.
Where
games/breakout/config.ts:32to40(LEVELS, one string per row,.123)games/breakout/scenes/GameScene.ts:146(LEVELS[this.level % LEVELS.length], the only place a layout is chosen)README.md:368(roadmap item)
Details
/**
* Level layouts, one string per row, COLS characters wide.
* . empty
* 1 normal brick (1 hit)
* 2 armored brick (2 hits)
* 3 heavy brick (3 hits)
*/
export const LEVELS: string[][] = [ ... ];The scene reads the layout from the constant directly, so there is no seam for a custom level.
Impact
Gives Breakout replay value beyond its built-in levels and gives contributors a no-code way to propose new ones.
Suggested fix
In steps, each shippable on its own:
- Move layout parsing and validation (row width, allowed characters, at least one brick) into a Phaser-free module with tests, and let the game scene take a layout through its start data.
- Add a CUSTOM entry to the Breakout menu that plays a level saved on this device (through
shared/storage.ts). Custom runs should not count toward the best score or trophies. - Add an editor scene: a grid the size of the brick field, cycle a cell through empty, 1, 2, 3 with click, tap or the action button, plus TEST and SAVE.
- Optional: encode a level in the URL so it can be shared, validated with the module from step 1.
Open questions: how many custom levels to keep, and whether saved levels belong in the backup file (shared/backup.ts checks each saved key against the shapes it knows).
Acceptance criteria
- A level drawn in the editor can be saved, reloaded after a refresh and played
- Invalid stored or shared level data is rejected without breaking the game
- Custom levels do not change the best score, top five or trophies
- The editor works with mouse, touch, keyboard and gamepad
Getting started
- Relevant files:
games/breakout/config.ts,games/breakout/scenes/GameScene.ts,games/breakout/scenes/MenuScene.ts,shared/storage.ts,shared/menu.ts - How to run tests:
npm test - Related docs:
CONTRIBUTING.md, the roadmap inREADME.md
Filed by repo-audit/feature-ideas at 5d19354. Severity: low. Effort: L. audit-key: enhancement|games/breakout/config.ts|LEVELS
Activity