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.

You getone complete HTML file in a single code block, then 3 short ideas to extend it.

The prompt

Prompt
Act as a senior front-end game developer who specializes in browser audio. Build Lantern Beat, an original four-lane rhythm tap game where glowing paper lanterns drift down a dusk-blue night sky toward a golden hit line. Generate the music live with the Web Audio API: a synthesized kick, filtered-noise snare, hi-hat and triangle bass at 112 BPM, scheduled slightly ahead on the audio clock, with a one-bar count-in and a set of about 50 seconds. Build the note chart from a seeded random generator so density rises through intro, groove and peak sections, with occasional two-lantern chords at the peak.
Rules:
- Controls: D F J K or the arrow keys for lanes 1 to 4, or tap or click a lane. Space starts, Esc pauses, M mutes.
- Grade each press against the audio clock: Perfect within 50 ms, Good within 110 ms labelled early or late, and Miss for bad timing or a lantern that passes the line. Show score, combo, accuracy and counts, then a results screen with a letter grade.
- Each hit plays a pentatonic note for its lane. Create the AudioContext on the first click or key press, keep volume low and show a visible mute toggle.
- Layout: responsive canvas for 360 to 1280 px wide frames, four warm-to-cool lane colors, a HUD above the field, and a start overlay with keys and a timing legend.
- Respect prefers-reduced-motion by turning off sparks and rising text. Pause automatically when the tab is hidden.
- Use no external files, libraries, fonts or storage.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.

Example output

One HTML file. Save it and open it in any browser.Open full screen

Example: Lantern Beat, a four-lane rhythm tap game with a beat built live in the browser.

Press Start the set. After a 3-2-1 count-in, lanterns drift toward the golden line. Hit D F J K, the arrow keys, or tap a lane as each lantern crosses the line. Perfect and Good hits play a note, and Good hits are marked early or late. Build a combo to score more. Each set generates a fresh pattern. Use M to mute and Esc to pause.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Note timing and judging both read the AudioContext clock, so the grades stay in sync with what you hear even when frames drop.
  • Scheduling drum hits about 150 ms ahead keeps the beat steady without audio files or libraries.
  • Exact timing windows, controls and section structure leave the model nothing to guess, so the first build is playable.

Paste the prompt into ChatGPT, Claude or Gemini. Save the returned code as lantern-beat.html and open it in any modern browser, or run it in the chat's preview or canvas. Turn your sound on.

Common edits

  • Change the BPM, the number of bars or the probability values in the chart builder to make the game easier, harder or longer.
  • Swap the lantern theme for falling stars or neon tiles by editing the lane colors and the lantern drawing function.

Prompt details

By
Prompts-GPT editors
Published

Did this prompt work?

Keep exploring

More in Simple HTML Games