ClaudeMods
☰
ZH-CN
● — 人在线 · 浏览 — 次
赞助提交作品
GitHub 仓库 · 发布者 germanfndez

cc-range

一个使用函数钩子在 Claude Code 提示符上方运行的第一人称像素艺术射击场,包含三十秒回合、轮换背景和芯片音乐音频。

已翻译

关于这个 mod

cc-range 是一个 Claude Code 插件,它在提示符上方放置一个可玩的第一人称射击场。它使用函数钩子来渲染像素艺术、捕获指针和键盘输入,并在不消耗 token 的情况下运行。玩家瞄准目标,这些目标在三十秒的回合中会缩小并移动得更快,同时有八个轮换背景以及合成的音效和音乐。README 提供了安装命令、控制方式、开发工具,并说明它需要函数钩子和交互式终端。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add germanfndez/cc-range
claude plugin install cc-range@cc-range
原文 / README

cc-range

A first-person shooting gallery that lives above the Claude Code prompt. Pixel art drawn with quadrant blocks, a pistol in your hand, a bullseye on a wall: aim with the pointer, fire, and every hit moves the target somewhere else and adds a point.

It runs on function hooks, so it draws itself, takes your mouse and keyboard, and costs zero tokens. You can play it while Claude works.

cc-range running above the prompt

Thirty seconds from the first shot. Every hit makes the next target smaller, faster, and shorter-lived — 2.7 seconds on its fuse at the start, three quarters of one by the end. Let the fuse run out and the target leaves on its own, and takes your streak with it.

Needs function hooks (early access, CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1) and an interactive terminal.

Install

/plugin marketplace add germanfndez/cc-range
/plugin install cc-range@cc-range

Then /range. Click the board once to give it the keyboard; Esc hands it back to the prompt.

Working on it instead? CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 claude --plugin-dir /path/to/cc-range.

| | | |---|---| | move the pointer | aim | | click, space, f | fire | | wasd or the arrows | aim without a mouse | | the green plate | starts the round — it costs no shot | | r | restart | | m | mute, sound and music both | | q | close the board | | /range stop | close it from the prompt | | /range reset | clear the record |

The clock only starts when you fire, so the board can sit open while you work. The record is on screen under the score, and it and the mute setting live in $.store, so they outlast the session. Misses leave holes in the wall.

Eight backdrops, and one takes over every five seconds

Dawn, noon, a meadow, dusk, a starlit night, rain, snow, and the desert — each with its own sky, ridges, and weather: sun, birds, clouds, stars, rainfall, snowfall, cacti. The barrier changes with it, so it is planks, then brick, then nothing but posts in open grass, then hay bales, corrugated iron, wet stone, a rope of bunting, and an adobe wall.

a brick wall at noon

a meadow on posts, with no wall at all

planks at dawn

Everything you hear is synthesised by the two scripts in tools/: the shot, the ring of the plate, the miss, and a sixteen-bar chiptune in A minor that plays under the whole thing. Nothing here is sampled from anyone.

Where it came from

anthropics/claude-code#91870 proposes function hooks — TypeScript that hooks into Claude Code the way Express middleware hooks into a request, up to and including the React tree it renders. Buried in that thread, sezaakgun posted cc-arcade: Tetris and seven other games above the prompt, playable while Claude works. That comment is why this exists.

Its write-up saved me the first day of the work.

Develop

bun tools/preview.ts 110 30 3       # one frame, in this terminal
bun tools/shot.ts out.png 110 30    # the same frame as a PNG, to judge the art
SCENE=3 bun tools/shot.ts out.png   # hold one backdrop still
MODE=ready bun tools/shot.ts out.png
node tools/make-sounds.mjs          # re-render the effects
node tools/make-music.mjs           # re-render the loop
bunx tsc --noEmit -p tsconfig.json  # run /plugin-types in Claude Code first,
                                    # which writes .claude/types

tools/shot.ts packs the canvas into quadrant cells and paints each one back out at 4×, so the PNG is exactly what the terminal shows. Judging pixel art by squinting at ANSI in a scrollback is not a thing you can do.

Layout

hooks/register.tsx      the command, the store, the sounds, the music, the AbovePrompt band
hooks/boards/range.tsx  the surface module: frame clock, keys, pointer
hooks/boards/scene.ts   one frame of the range, into a pixel canvas
hooks/boards/paint.ts   the canvas, a 5×7 face, and the quadrant packing
hooks/game/range.ts     the target, the aim, the clock, and what a shot does
tools/                  preview, PNG capture, and the two synthesisers

paint.ts is carried over from cc-flappy, an earlier plugin of mine, which is where the canvas and the quadrant packing were worked out.

MIT.

获取徽章

这是你的项目吗?把这个徽章放进 README 或网站,链接回本页。

Featured on ClaudeMods
尺寸
配色
Markdown
HTML

更多类似作品