# Flight

A small two-phone flight game drawn on a 2D canvas. Raise the throttle, steer into the central ring with roll and pitch, and earn a point each time you pass through it. The STALL light comes from the game's throttle threshold and keeps that state when a phone resumes. The bottom face button sends a signal cue and rumble.

From the SDK root, with Node 22 or newer:

```sh
node examples/flight/server.mjs
```

Open [the game and QR lobby](http://127.0.0.1:49702/). No graphics library or build is required. For real phones on the same Wi-Fi, replace this example IP with the computer's reachable address:

```sh
PUBLIC_ORIGIN=http://192.168.1.20:49702 node examples/flight/server.mjs
```

Open the LAN URL on the shared display, then scan its QR. In MENU choose **Flight**; the game's mode suggestion does not force that choice. Push the left throttle lever up, then drag the central stick to roll and pitch. Pull back to climb and push forward to descend. Gamepad fallback uses the left stick and right trigger for throttle.

For iPhone tilt, first use [trusted local HTTPS](../local-common/README.md#motion-on-iphone). Tap **TAP FOR TILT on the Flight instrument**, allow motion, then gently move the phone and wait for the first visible response. Hold it comfortably and tap **LEVEL**. LEVEL records that hold as neutral; it does not ask for permission or produce a sensor reading. If access is denied or readings never arrive, turn tilt off in MENU and use touch. Throttle always has a touch lever. The phone horizon shows control deflection, rather than aircraft attitude supplied by the game.

```sh
node --test examples/flight/test.mjs
```

Two isolated phone pages in one SDK driver receive real throttle, roll/pitch, LEVEL and signal touches. The test checks separate aircraft, ring progress, STALL telemetry, cue/rumble receipts, leave, same-seat reload/resume, removal, invitation rotation and teardown. Physical sensors, permission prompts and sound/vibration remain [device checks](../local-common/README.md#scratch-files-and-captures).

The simulation is in `server.mjs`, canvas drawing in `client.mjs`, and lifecycle/shutdown handling in `../local-common/runtime.mjs`. Type `remove p1` to release a seat. Ctrl+C stops the game and HTTP(S) server.
