Build an Orbital Gravity Slingshot Game in a Single HTML File
Create Perihelion, an offline HTML5 canvas arcade game with inverse-square gravity physics, live trajectory previews, and slingshot combo scoring.
Text prompt for ChatGPT and Claude
The prompt
Act as a senior HTML5 game developer. Build Perihelion, an original orbital gravity slingshot arcade game in a single self-contained HTML file. The player launches a space probe past glowing gravity wells to reach a target gate across procedurally generated sectors. Follow these rules: 1) Simulate real inverse-square gravity physics on an HTML5 canvas with a live dotted trajectory preview when aiming. 2) Support both mouse or touch drag-to-aim and keyboard controls using Left and Right arrows for angle, Up and Down for power, and Space to launch. 3) Award slingshot combo multipliers when the probe curves close to a gravity well without crashing into its core. 4) Include a compact top HUD showing Sector, Score, Shots left, Combo, and Mute and Reset buttons. 5) Synthesize launch, slingshot chime, target hit, and crash sounds with the Web Audio API after the first user interaction, keeping volume low. 6) Fit cleanly in 360px to 1280px viewports with high-contrast deep-space colors, no external assets, no localStorage, and reduced motion support. Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Uses the exact same inverse-square physics step for both the live trajectory preview and actual flight so shots behave predictably.
- Combines pointer drag-to-aim with full keyboard controls so the game plays smoothly on mobile touchscreens and desktop browsers.
- Wraps all state and Web Audio synthesis inside an IIFE with zero external dependencies or storage calls for instant sandboxed execution.
Paste the prompt into Gemini, ChatGPT, or Claude, then save the generated code as an .html file and open it in any browser—or preview it directly in Canvas or Artifacts.
Common edits
- Add moving or binary gravity wells in higher sectors to create dynamic orbital timing puzzles.
- Swap the deep-space palette for a minimalist blueprint or neon wireframe theme by updating the canvas color constants.
Reuse it: Use in a workflowTurn into a skillAdapt in the builder
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
More like this
Build a Four-Lane Rhythm Tap Game with a Generated Beat in One HTML File
A ready-to-paste prompt that builds a complete four-lane rhythm tap game with a live Web Audio beat, Perfect/Good/Miss timing grades, combo scoring and a results screen.
Build a Garden Caterpillar Snake Game with Swipe and Wrap Mode in HTML
A prompt that produces Leafline, an original snake-style game where a caterpillar eats garden leaves, with swipe controls, buffered turns, wrap mode and a speed slider.
Build a Match-Three Tile Swapping Puzzle with Cascades and Combo Scoring
Generates a complete single-file match-three puzzle with swap validation, gravity refill, chain-reaction combo scoring and an automatic reshuffle when no moves remain.
Build a Tower Stacking Game with Slice-Off Blocks in a Single HTML File
A ready-to-paste prompt that builds a one-tap tower stacking game where overhangs are sliced off, perfect drops restore width, and the camera follows the tower upward.
Build a Neon Circuit-Routing Tile Puzzle Game in One HTML File
Create VoltGrid, a self-contained neon circuit-routing puzzle game with guaranteed solvable levels, par tracking, and Web Audio lock-in clicks.
Build a Word-Chain Ladder Puzzle Game with Hints in One HTML File
Create RungCraft, an offline word-ladder puzzle game with a built-in dictionary graph, BFS shortest-path par, step-by-step hints, and move efficiency ratings.
- Build a Color Sequence Memory Game with Synth Tones in One HTML File
- Build a Daily Five-Letter Word Guessing Game with Colorblind Mode in One HTML File
- Build a Gnome-Popping Whack-a-Mole Game With Decoys in One HTML File
- Build a One-Button Fox Endless Runner Game in a Single HTML File
- Build a Paddle and Bricks Game with Power-Ups and Levels in One HTML File
- Build a Reaction Time Tester Game with False-Start Detection in One HTML File