LUNA-2: Character Controller — Jump, Gallop, Trails
Starter project for Mackenzie's Pink Unicorn Game built with p5.js 1.9.0, implementing the core character controller.
Controls
| Input | Action |
|---|---|
| Tap / Click | Move unicorn toward tap point |
| Spacebar | Jump (when grounded) |
| Proximity | Long distances trigger gallop speed boost |
Features
- Physics: Jump with gravity affecting vertical movement
- Gallop: Speed increases when far from target; dust particles trail behind
- Movement sparks: Trail particles (sparkles) follow unicorn path; more frequent during gallop
- Floating islands: Multiple platforms at varied heights
- Collectibles: Crystals with particle burst feedback
- Touch-friendly: Works with mouse and touch
Technical Details
- p5.js loaded from CDN (no build step)
- Easing horizontal movement (
lerp) with gallop factor - Vertical movement simulation with gravity and ground collision
- Particle systems for trails, dust, and collection bursts
colorMode(RGB, 255); pink/unicorn palette defined in code
Quick Start
cd luna
python3 -m http.server 8080
# Visit http://localhost:8080
Or simply open luna/index.html directly in a browser.
Verification
Open in browser → canvas renders a white unicorn with a pink mane. Tap anywhere: unicorn glides toward the tap position. Jump with spacebar. Move far away: unicorn speeds up( gallops) leaving a dust trail and sparkles . Collect crystals to see bursts.
Files
index.html— p5.js import + containersketch.js— Main game logicstyle.css— Responsive layout and styling