import { useState } from "react"; import { gameApi, useGame } from "../store.js"; import { Quickbar, SoundToggle } from "./Hud.jsx"; import SimulatorPanel from "./SimulatorPanel.jsx"; export default function MicroduckControls() { const loco = useGame((s) => s.loco); const mode = useGame((s) => s.modeLabel); const locked = useGame((s) => s.emotionBusy || s.locoSwitching || s.scriptPlaying); const recording = useGame((s) => s.scriptRecording); const [head, setHead] = useState([0, 0, 0, 0]); const release = () => gameApi.setDrive?.(0, 0); const drive = (e, forward, turn) => { e.currentTarget.setPointerCapture(e.pointerId); if (recording) gameApi.script?.add(`${forward > 0 ? "Forward" : forward < 0 ? "Backwards" : turn > 0 ? "Turn left" : "Turn right"}`, async () => { gameApi.setDrive?.(forward, turn); await gameApi.script.wait(1); gameApi.setDrive?.(0, 0); }); else gameApi.setDrive?.(forward, turn); }; const action = (label, fn) => recording ? gameApi.script?.add(label, async () => { await fn(); await gameApi.script.wait(0.4); }) : fn(); return

{mode} · {loco}

Move · hold to drive
{[["Forward", 1, 0], ["Backwards", -1, 0], ["Turn left", 0, 1], ["Turn right", 0, -1]].map(([label, forward, turn]) => )}
Actions
Emotions
{[["joy", "Happy"], ["sadness", "Sad"], ["anger", "Angry"]].map(([id, label]) => )}
Head {["Neck pitch", "Head pitch", "Head yaw", "Head roll"].map((label, i) => )} Appearance & locomotion Camera
Keyboard & gamepad

Arrows / WASD / ZQSD: walk and turn. Q/E: kicks. F: alternate kicks. R: sit/stand or crouch. G: ground pick. M: legs/rollers. Space: reset. C: chase camera. Drag: orbit. Scroll: zoom.

Gamepad: left stick moves; right stick orbits; Y controls head; LB/RB kick; X or D-pad down sits; A picks; hold D-pad up switches mode; RT quacks; LT wheee; R3 chase; Menu pauses.

; }