Add orbit-dodger minigame with pointer/keyboard directional input - #2
Merged
Merged
Conversation
Extends InputState/InputController with heldDirection (Arrow keys/WASD) and pointerX (follow-the-pointer drag) so games beyond the single-button dino-runner jump are possible. Extracts mulberry32 and the AABB collision check into src/games/shared/ for reuse. Adds orbit-dodger: dodge falling obstacles by moving the ship left/right, original chevron-ship and faceted-gem art. Wires ?game=orbit-dodger into all four example apps and documents the new game/InputState fields in the README.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
orbit-dodger: dodge obstacles falling from the top by moving the ship left/right, original chevron-ship + faceted-gem art (distinct from dino-runner's visual language).InputState/InputControllerwithheldDirection(Arrow keys / WASD, held) andpointerX("follow the pointer" drag/touch, canvas-local logical pixels) — purely additive,dino-runneris unaffected.mulberry32and the generic AABBintersects()check intosrc/games/shared/so both games reuse the same PRNG/collision primitives instead of duplicating them.?game=orbit-dodgerinto all four example apps (vanilla, react-vite, nextjs, angular) so both games are reachable without extra setup.InputStatefields in the README.Test plan
npm test— 135/135 passing (30 new: shared rng/collision, orbit-dodger movement/fallers/collision/index, extendedInputControllerpointer/keyboard tests).npm run lint— clean.npm run build— core/react/angular entries all build.npm run size— core bundle 6.86 KB gzip (was 5.72 KB before this change), well under the 15 KB budget.?game=orbit-dodgermounts the canvas with no console errors inexamples/vanilla. Pixel-level visual verification wasn't possible in this environment (the preview browser pane doesn't actively composite frames, sorequestAnimationFrameis paused) — relying on the automated test suite (including a "render doesn't throw" test) for render-path coverage instead.