cocos_scaffold_input_abstraction
Generate a unified keyboard and touch input manager for Cocos Creator games, providing stable runtime APIs for movement, jumping, and firing actions.
Instructions
Generate InputManager.ts + meta - unified keyboard/touch input singleton.
The generated script exposes a stable runtime API that other game scripts read each frame::
InputManager.I.moveDir // cc.Vec2, normalized, x/y in -1..1
// WASD + arrows; diagonals scaled 0.707
InputManager.I.jumpPressed // boolean, true for exactly one frame
// after SPACE press; reset in lateUpdate
InputManager.I.firePressed // boolean, true for one frame after
// KEY_J or any touch-startSingleton pattern: attach to exactly one persistent GameManager-like node. Extra instances self-destroy in onLoad.
Typical flow::
r = cocos_scaffold_input_abstraction(project)
# r["uuid_compressed"] is the 23-char form the scene needs
cocos_add_script(scene, gm_node_id, r["uuid_compressed"])Returns {path, rel_path, uuid_standard, uuid_compressed}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| rel_path | No | InputManager.ts |