tile-picking-interaction — Claude Code skill
Turns a pointer or touch position into the exact isometric tile under it, with camera pan and zoom taken into account. Useful when clicks land on the wrong cell.
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a claude-codeWhat tile-picking-interaction does
The skill lays out the picking order: read the pointer in screen space, invert the camera transform, convert screen coordinates to grid coordinates, then round to a tile. The result gets clamped to the map bounds, and walkability can be checked if the game needs it. A highlight is drawn on the picked tile, and a click hands the tile coordinate to the gameplay handler.
Inside are seven steps and a short code sample: screenToWorld(pointer, cam), followed by worldToGrid(world, W, H) and rounding. Two companion skills are referenced, camera-pan-zoom-controls and isometric-grid-math — the inverse transform and the grid conversion steps come from there.
A table of excuses covers the usual shortcuts, like skipping the camera inverse or leaving out the highlight. Skip the inverse and picking breaks as soon as the camera moves. The closing checklist demands correct tiles at any pan and zoom, a highlight that matches the real selection, and clicks that dispatch the right grid coordinate.
What it helps with
- fix tile selection that drifts once the camera pans
- add a hover highlight for the tile under the cursor
- place objects on the clicked cell
- clamp picking to the map bounds
- verify hit-testing across zoom levels
Example prompts for the agent
- Clicks pick the wrong tile after I pan the camera — walk through the tile-picking-interaction skill and fix it
- Add a hover highlight and place objects on click
- Test tile picking at several zoom levels and pan offsets
How to install tile-picking-interaction
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a claude-code2Manually: put the files in place
~/.claude/skills/tile-picking-interaction/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/tile-picking-interaction/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a codex2Manually: put the files in place
.agents/skills/tile-picking-interaction/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a cursor2Manually: put the files in place
.cursor/skills/tile-picking-interaction/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install 0xheycat/isometric-game-skills tile-picking-interaction2Manually: put the files in place
.github/skills/tile-picking-interaction/SKILL.md1Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a gemini-cli2Platform CLI
gemini skills install https://github.com/0xheycat/isometric-game-skills --path skills/tile-picking-interactionManually: put the files in place
.devin/skills/tile-picking-interaction/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about tile-picking-interaction
How do I install tile-picking-interaction in Claude Code?
Run npx skills add 0xheycat/isometric-game-skills --skill tile-picking-interaction -a claude-code. The skill file lands at ~/.claude/skills/tile-picking-interaction/SKILL.md.
What does tile-picking-interaction do?
It maps a pointer position onto an isometric grid tile: inverse camera transform, rounding to a cell, clamping to map bounds, and a highlight for feedback. On click the coordinate goes to the gameplay handler.
Why does tile picking break when I zoom?
Without the inverse camera transform the hit-test stays in screen coordinates and stops matching the map after any pan or zoom. The skill insists on inverting at every step.
Source text
SKILL.md · MIT
--- name: tile-picking-interaction description: Use when converting a mouse/touch position into the correct isometric tile for selection, highlighting, and placement. license: MIT --- # Tile Picking & Interaction ## Overview Picking is screen->grid with the camera inverse applied first. This skill turns a pointer position into the exact tile under it, with a highlight and hit-test that respects camera pan/zoom. ## When to Use - Clicking selects the wrong tile. - You need hover highlight or click-to-place. - Picking ignores camera pan/zoom. ## Process 1. Take the pointer position in screen space. 2. Apply the inverse camera transform (see `camera-pan-zoom-controls`). 3. Apply screen->grid from `isometric-grid-math` and round to a tile. 4. Clamp the result to map bounds and check walkable if needed. 5. Draw a highlight on the picked tile for feedback. 6. On click, dispatch the tile coord to the gameplay handler. 7. Test picking at multiple zoom levels and pan offsets. ```js const world = screenToWorld(pointer, cam); const tile = worldToGrid(world, W, H); // then round ``` ## Rationalizations (Stop Lying to Yourself) | Excuse | Reality | |---|---| | "I will skip the camera inverse" | Then picking breaks the moment you pan/zoom. Always invert. | | "No need to highlight" | Players need feedback on what they will click. Highlight. | ## Red Flags - STOP if you catch yourself: - Picking that ignores camera pan/zoom. - No rounding so edge tiles mis-select. - No visual highlight feedback. ## Verification You are NOT done until every box is checked: - [ ] Picked tile is correct at any pan and zoom. - [ ] Hover highlight matches the actual selected tile. - [ ] Clicks dispatch the right grid coordinate.
© 0xheycat · MIT · 0xheycat/isometric-game-skills