| name | creating-walking-characters |
| description | Creates animated SVG characters that walk along the bottom edge of the display with speech bubbles, physics interactions, and special actions like shooting, power-ups, eating, and singing duets. Uses requestAnimationFrame with direct DOM manipulation. Use when adding interactive character animations. |
Creating Walking Characters
SVG characters walk along the bottom, interact with physics objects, have speech bubbles, and perform special actions.
Two Character Systems
1. Gnomes (Fantasy Characters)
- Walk back and forth along the bottom
- Push physics objects (piled logos) as they walk
- Show speech bubbles with random messages
- When gnomes meet: sit down and eat pancakes
- Can shoot projectiles at flying objects
- Golden power-up: super saiyan mode (1.5x size, 3x speed, golden aura)
- Sing famous song duets
2. Named Characters (Real People)
- Independent from gnomes
- Walk similarly but simpler behavior
- Have conversations with each other (alternating speech bubbles)
- Distinct bubble colors per character
- No shooting, no power-ups
Character Rendering
Characters are inline SVGs rendered as DOM elements (not React components):
function createCharacterElement(type: string): HTMLDivElement {
const el = document.createElement("div");
el.className = ;
el. = ();
el.. = ;
el.. = ;
container.(el);
el;
}