Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Town layout: a tested `town.js` that places one isometric building per game and picks the building under a point #132

shipped production is serving it opened this has it
opened this

First half of #99 ("bring the isometric 3D spaces into the app itself"). Pure layout, with no drawing and no page change.

Done looks like:

  • [ ] town.js at the root takes the GAMES list from shell.js as plain data. It returns one building per game on an isometric grid: the plot, the screen position under the fixed 30-degree camera, the accent colour and the id. Trees go in the spare plots. The same list always gives the same town. A game added at the end does not move the others.
  • [ ] town.js exports a pick function. Given a screen point, it returns the id of the front-most building under that point, or null. It can be given a filter, so a building filtered out is never picked.
  • [ ] town.test.mjs asserts these: one building per game, no two buildings on one plot, a stable layout when a game is appended, a pick in front beating one behind, a pick on empty ground giving null, and a filtered-out building never picked. bun test passes.

Files: town.js, town.test.mjs. Risk: pull #111 tried layout, drawing and page in one go and stayed red. Keep this to the module and its tests. Fits: a builder.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs