Skip to content

codebuilder-1 detail — mood-creature

What was built

games/mood-creature/game.js — ~270 lines, vanilla JS, no external deps.

Mechanic

Single procedurally-drawn blob creature on an HTML5 canvas. Player taps one of 5 emotion buttons; the creature morphs in response:

Mood Body Color Eyes Motion
Calm Very round Teal/green Medium, slow blink Gentle bob
Excited Bumpy Golden yellow Large, fast blink Vertical bounce
Sad Drooped Blue/indigo Small, rare blink Slow sag
Curious Slightly spiky Purple Huge, frequent blink Sideways drift + tilt
Angry Very spiky Crimson Narrow, almost no blink Low-freq jitter

Discovery system

  • 5 mood badges unlock on first tap of each mood.
  • 3 hybrid badges unlock by switching between specific pairs within 2 seconds:
  • Calm → Excited = Playful (pink glow)
  • Sad → Angry = Frustrated (deep purple glow)
  • Curious → Calm = Dreamy (soft blue glow)
  • Flash overlay announces each hybrid discovery. Status line tracks N / 8 moods discovered.

Rendering

  • Bezier-free blob: N=10 radial points with per-frame sine noise scaled by spiky param.
  • Color, spikiness, eye scale all lerp with cubic ease on mood transition.
  • Glow: double-draw with shadowBlur:32 matching creature color.
  • Hybrid: additive color blend peaks mid-duration then fades.
  • Angry uses low-frequency jitter (new position every ~80ms) rather than per-frame random to avoid strobe.

Files touched

  • games/mood-creature/game.js — full rewrite (270 lines)
  • games/mood-creature/index.html — updated meta description only
  • manifest.json — already had playable:true at index 12; no change needed

To verify

Open games/mood-creature/index.html in a browser. Tap each button, then chain calm→excited within 2s to trigger the Playful hybrid.