📚 Encyclopedia

Games & Graphics · updated 2026-10-13

Touch controls for mobile action and platformer games

touchmobilecontrolshapticsd-paduxflutter

Design rules for on-screen controls in a landscape platformer, from published postmortems (Dead Cells mobile port by Playdigious, Celeste mobile) and what Run learned shipping a mobile-web version in 2026-08.

Layout

D-pad vs joystick

For binary left/right movement a d-pad beats a virtual joystick (no drift, no lost center). Dead Cells players preferred a floating pad 80/20 for a full-direction action game, which is a different problem. Include a small center dead zone.

Slide-capable d-pad (Run v0.8.83): make left/right ONE pointer surface with a per-pointer direction map, so the thumb slides between directions without lifting; 6 px hysteresis at the center (no flicker), a 14 px invisible hit margin (+20 px above), and a haptic tick on direction change. Two independent buttons felt broken.

Sizes and opacity

Guideline Minimum
Apple HIG 44x44 pt
Material 48x48 dp
Game action buttons 56-72 dp (64-80 for primary)
Run: 64 dp d-pad, 52/72 dp actions with a 0.7-1.3 user scale (raise the floor to 0.8 so
nothing goes under ~42 dp). Extend hit areas ~8 dp beyond the art. Idle opacity 0.2-0.3 with a
clear pressed state (0.15 idle was too faint).

Haptics

Event Strength
Coin/pickup soft tick ~5 ms
Jump, landing from height light ~10 ms
Dash, wall kick medium ~15 ms
Death heavy ~30 ms with shake
Level complete two-pulse success
Menu buttons selectionClick()
iOS Core Haptics is consistent; Android varies wildly by device (custom compositions only on
API 30+ with good hardware). Always offer an off switch; test on real devices. A ~20 ms click
sound together with the haptic makes controls feel precise.

Forgiveness

Touch adds ~30-50 ms of latency; coyote time and jump buffering (~116 ms each) already cover it. Consider an optional auto-wall-slide assist. See Platformer movement feel (coyote time, jump buffering, wall jumps).

Mobile-web lessons from Run

Browser canvas games (justinahampton.com arcade)

Lessons from Orb Destroyer 2, Joyride, Measly and Recourse (2026-08/09), all single-page canvas games played on Justin's Android phone. - Never put the thumb over the action. Orb Destroyer 2 puts its virtual stick and bomb button below the square stage in portrait and beside it in landscape, and shrinks the stage to make room (calc(100vh - 250px) portrait). One pointerId owns the stick (pointer events plus setPointerCapture, wrapped in try/catch because synthetic test pointers throw); 10 px dead zone, 38 px knob travel; deflection aims and autofires. - A thumb-relative stick anywhere on the stage (Measly): 8 px dead zone, full speed at 40 px, a quick tap acts, and the act button's label says what act would do right now (EAT / SIT / FOLD). - Let players choose buttons or swipe per axis. Joyride stores {accel, steer} each buttons|swipe (default buttons for both, Justin's call). All-buttons became a centered arrow-key d-pad (gas over left/brake/right, 66 px squares) with actions split to both sides. When the same button elements move between containers, style them by class (.dir), not by descendant selectors of the old container. - Gate touch UI on the input device, not width. Show touch controls and the settings gear on (pointer: coarse) (no Esc key on a tablet), hide them under (hover: hover) and (pointer: fine). Allow ?pad=1 to force touch mode for tests. - Watch class-name collisions on <body>. A body flag named pad matched the pad component's own .pad { display: none } rule and blanked the whole page, while a harness check on the pad's own display still passed. Name it body.touch. - Size overlay text with container query units off the stage, not viewport units. On a phone the stage is ~380 to 416 px, so 8vw titles spilled over the HUD and under the stick (headless did not reproduce it because Android's monospace fallback is wider). Give the stage container-type: inline-size and size titles, copy, gaps and buttons with clamp(min, N cqw, max); add justify-content: safe center; overflow-y: auto so the worst case scrolls rather than spilling both ways. - Pause on touch needs a button (a pause key does not exist there) and the pause sheet needs a Resume button; also auto-pause on visibilitychange. One "pause owner" (shop, settings or menu) should be the only thing that can resume, or Space over a settings panel resumes the game underneath. - Fullscreen on the start tap for coarse pointers (inside the gesture); hide the fullscreen button where unsupported (iPhone Safari). - A turn-based game sidesteps most control problems: tap a ghost destination dot, the same on desktop and phone, with taps snapped to the nearest legal move within ~1.6 cells.

See also

Linked from

Sources: run memory (research-touch-controls.md, research-mobile-game-ui.md, mobile-shell.md, session-v065-v075.md), justinahampton memory (arcade-orbdestroyer2, arcade-joyride, arcade-measly, arcade-recourse, arcade-encircle)