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
Sign in to join this conversation.
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.jsat the root takes theGAMESlist fromshell.jsas 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.jsexports 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.mjsasserts 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 testpasses.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.