✏️ Pencil Hit
By Just Sparrow
A single-file tap-to-throw arcade game in the style of the classic Knife Hit, rendered in the same picture-book aesthetic as Jumping Bird and Watermelon Game (warm dark-brown outlines, flat fills, Fredoka + Jua typography). Throw pencils into a rotating wooden log — time each throw so the pencil doesn't collide with one already stuck in.
How to Play
- Tap GAME START to begin.
- Tap anywhere on the play area (or press Space / ↑) to throw a pencil straight up at the log.
- The pencil sticks in safely if it lands far enough from every existing pencil. +1 point per stick.
- Hitting an apple on the log earns +3 bonus points and clears it.
- If the incoming pencil collides with a pencil already stuck in the log, the game ends immediately.
- Complete a stage by landing all 7 pencils — the log clears, a new stage begins, and the challenge increases.
- Tap Play Again on the game-over screen, or 🏠 Home to return to the start screen.
Features
Pencil
Each pencil is drawn with five distinct sections:
- Lead tip — dark grey triangle; the contact point that embeds into the log.
- Wooden cone — beige trapezoid exposing the shaved wood.
- Yellow body — long flat rectangle with faint vertical grain lines.
- Ferrule — silver/grey metal band.
- Eraser — pink rounded-bottom cap.
Pencils rotate with the log once stuck. A row of dots at the bottom shows how many throws remain in the stage.
Rotating Log
A circular wooden log sits in the upper portion of the canvas. It has a warm amber fill with concentric annual rings, radial grain lines, and a centre knot.
Rotation is driven by a sinusoidal acceleration model: a sine wave with randomly chosen amplitude and period is integrated twice per frame (into velocity, then angle). The log naturally speeds up, slows down, and reverses direction — the rhythm changes every cycle so the player cannot memorise a pattern. Period is randomised between 90 and 180 frames; angular velocity is capped at ±0.14 rad/frame.
Stage Progression
Each stage requires 7 successful pencil throws. Rotation intensity grows with each stage via an amplitude scale that increases by +0.2 up to 2.0, then +0.1 up to 3.0, then +0.05 indefinitely.
From Stage 4 onward, pre-stuck pencils appear — one additional pencil every two stages, up to a maximum of 7 — evenly distributed around the log at a random starting angle.
| Stage | Pre-stuck pencils |
|---|---|
| 4–5 | 1 |
| 6–7 | 2 |
| 8–9 | 3 |
| 10–11 | 4 |
| 12–13 | 5 |
| 14–15 | 6 |
| 16+ | 7 (max) |
Apples
Red apples sit on the log surface and rotate with it. Hitting one awards +3 points and a particle burst. Higher stages place more apples (up to 4).
Sound Effects
All sounds are synthesized on the fly — no external audio files.
- Sawtooth sweep on throw · sine thud on stick · rising sweep on apple hit.
- Square-wave crunch on collision · arpeggio on stage clear · descent on game over.
A 🔊 / 🔇 mute button silences everything. Audio auto-resumes on page return from background.
Quality-of-Life Details
- 🏠 Home resets and returns to the start screen.
- Best-score persistence via
localStorage— beating your record shows a ✨ New Best ✨ flourish. - Live rescale on resize — the in-progress game stays consistent if the window is resized.
Design
- Portrait layout (9:16) sized in
vwunits — fits entirely on a phone without scrolling. - No canvas border or background fill — the game area blends seamlessly into the white page.
- Dark-brown outlines (
#3a2412) on every shape, matching the hand-drawn picture-book palette of the other games in the set. - Yellow + orange start/restart buttons with a layered inset shadow for a 3D pressable look.
- Fredoka + Jua font (Google Fonts) for a rounded, child-friendly look.
Tech
- Single HTML file — no build step, no external assets except Google Fonts.
- Canvas 2D rendering, Web Audio API sound synthesis.
- Fixed-timestep loop at 60 Hz — physics rate independent of display refresh.
- Collision is angle-based: incoming pencil rejected if within 0.20 rad (~11°) of any stuck pencil in the log's local frame.
Loading comments...
Other Codes
No other codes yet