handling-user-input
Skill404 starsChanged 14 days agoApache-2.0View on GitHub
Game will always use the same control scheme/buttons and mapping of the gamepad and keyboard. Use when creating or modifying a game.
In this repository82 other files it gives its agents.
- agents/charm-persona-quiz-for-agents/AGENTS.mdAGENTS.md
- agents/newsroom-harness/AGENTS.mdAGENTS.md
- codelabs/ai-toolkit-lab-2/hackathon-judge/frontend/.agents/skills/vercel-composition-patterns/AGENTS.mdAGENTS.md
- codelabs/ai-toolkit-lab-2/hackathon-judge/frontend/.agents/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- codelabs/bwg002-devrel-2/AGENTS.mdAGENTS.md
- agents/charm-persona-quiz-for-agents/llms.txtllms.txt
- calendar-exportSkill
- session-notesSkill
- calendar-exportSkill
- session-notesSkill
- calendar-exportSkill
- session-notesSkill
- calendar-exportSkill
- session-notesSkill
- compare-subagent-mcp-visibilitySkill
- batch-executing-test-suitesSkill
- circuit-breaker-reporterSkill
- generating-mock-imagesSkill
- making-forms-demoSkill
- multi-step-workflow-reporterSkill
- auditing-inventorySkill
- newsroom-harnessSkill
- verify-sourcesSkill
- write-bulletinSkill
- repo-walkthroughSkill
- go-project-setupSkill
- latest-software-versionSkill
- video-descriptionSkill
- adk-memory-bank-initializerSkill
- agent-containerizerSkill
- cloud-run-agent-architectSkill
- gcp-agent-eval-engine-runnerSkill
- gcp-agent-eval-metric-configuratorSkill
- gcp-agent-golden-dataset-builderSkill
- gcp-agent-model-armor-shieldSkill
- gcp-agent-safety-gatekeeperSkill
- gcp-agent-sdp-template-factorySkill
- gcp-agent-shadow-deployerSkill
- gcp-agent-tool-trajectory-evaluatorSkill
- gcp-production-secret-handlerSkill
- mcp-connector-generatorSkill
- go-architectSkill
- go-backend-devSkill
- go-reviewerSkill
- go-test-expertSkill
- vercel-composition-patternsSkill
- vercel-react-best-practicesSkill
- lab-helperSkill
- start-frontendSkill
- brand-guidelinesSkill
- brand-guidelinesSkill
- kubernetes-1-37-manifestsSkill
- knowledge_catalog_governanceSkill
- banana-breadSkill
- cheese-breadSkill
- drawingsSkill
- paintingsSkill
- photographySkill
- ticket-triageSkill
- adding-easter-eggSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
When creating or modifying a game:
- Distinctive: line 115
If useful to explain the game's objective, the objective may be improved to include the new behavior.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Input Mechanism
When creating or modifying a game:
Gamepad
- Use the Web Gamepad API to detect and use gamepads
- Use the gamepad to control the player
- Allow either the left stick or D-pad to move the player
- Use the face buttons for actions (Button 1, Button 2, Button 3, Button 4)
- Physical Hardware Wiring Quirk: On the physical arcade cabinets, buttons were wired non-standardly:
- B = 0
- A = 1
- Y = 2
- X = 3
- Home = 8
- Restart = 9
- Gamepad Adapter Wrapper: When polling the gamepad in
update(), implement the virtual gamepad adapter wrapper to remap the inputs transparently so game logic and tutorial text can refer to semantic buttons (e.g.pad.A) correctly:
create() {
// rest of function
this.initGamePad();
}initGamePad() {
this.input.gamepad.start();
this.activeGamepad = null;
// 1. Check for gamepads ALREADY connected before the game booted
if (this.input.gamepad.total > 0) {
// Grab the first available valid gamepad from Phaser's manager
this.activeGamepad = this.input.gamepad.gamepads.find(pad => pad !== null);
if (this.activeGamepad) {
console.log(`Found pre-connected gamepad: ${this.activeGamepad.id}`);
}
}
// 2. Fallback listener for gamepads plugged in AFTER the game started
this.input.gamepad.on('connected', (pad) => {
// Only assign it if we don't already have an active gamepad
if (!this.activeGamepad) {
this.activeGamepad = pad;
console.log(`Gamepad plugged in mid-game: ${pad.id}`);
}
});
}update() {
const rawPad = this.activeGamepad;
// Remap hardware wiring inversion where physical face buttons are swapped:
// Physical wiring: B=0, A=1, Y=2, X=3, Home=8, Restart=9
// Standard Web Gamepad API: A=0, B=1, X=2, Y=3
const pad = rawPad ? {
...rawPad,
A: rawPad.B,
B: rawPad.A,
X: rawPad.Y,
Y: rawPad.X,
isButtonDown: (index) => {
if (index === 0) return rawPad.isButtonDown(1);
if (index === 1) return rawPad.isButtonDown(0);
if (index === 2) return rawPad.isButtonDown(3);
if (index === 3) return rawPad.isButtonDown(2);
return rawPad.isButtonDown(index);
},
left: rawPad.left,
right: rawPad.right,
up: rawPad.up,
down: rawPad.down,
axes: rawPad.axes,
buttons: rawPad.buttons
} : null;
// rest of function
}Keyboard
- Use the keyboard to control the player
- Use the Arrow Keys to move the player
- Use the A, S, Z, X keys for actions (matching Button 1, 2, 3, 4)
- Hardware Keyboard Encoder Quirk: On cabinets using USB keyboard encoders, because buttons A and B are mounted inversely, physical Button A sends key
Xand physical Button B sends keyZ. When polling primary fire actions for Button A in keyboard environments, checkthis.keys.xinstead ofthis.keys.z.
Control tutorial / explainer
- Add a simple controls diagram / explainer to the game's start/intro screen to explain the controls.
- Ensure it explains both the keyboard controls AND the gamepad controls.
- For the visual diagram of the controls:
- Show arrow keys for directional movement (left, right, up, down)
- Prioritise the layout to match the gamepad inputs
- IMPORTANT: Display control diagram and ensure game DOES NOT start until player input.
Update game config.json
The game's config.json, found in the game's root folder (e.g. <game-folder>/config.json) contains a controls section that defines the labels for buttons A, B, X, and Y. These arew the only 4 buttons allowed in the config.
When the game is created or modified, this config.json file should be updated to reflect the correct labels for each button. For example, if a code edit adds business logic so that the B enables the player to jump, set the label to "Jump". Labels must be short and limited to one word, or two words at most and MUST be an action (e.g. "Jump", "Run", "Fire", "Crawl", "Climb", etc.). There is limited space where the label will render in the UI so it must remain short.
If useful to explain the game's objective, the objective may be improved to include the new behavior.
Example:
{
"title": "Space Pilot",
"objective": "Navigate your spaceship while evading obstacles. Destroy them for points.",
"controls": {
"A": "Shoot",
"B": "Evade",
"X": "Roll Ship",
"Y": ""
}
}Verification
- Implemented Gamepad
- Implemented Keyboard
- Implemented Control tutorial
- Updated config.json if necessary
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

