Make the world react to the player's location. Connect physical space to game logic.

Position triggers state. When the player walks into a zone, the game state changes. This connects the 3D world to the systems we'll build in Week 3.

Ami — Combat Risk Engine

If in Manhattan zone → riskLevel increases. If in Camp → can bank (later). For now, console log "Danger Zone" or "Camp".

Ida — Economic Growth Engine

If on a lot → can build (later). If outside lots → no action. For now, console log "On Lot #3" or "Off Lot".

Define game state and check player position each frame:

const gameState = { zone: "safe", previousZone: "safe" };

Position checking inside the animation loop:

// Update zone based on player position if (player.position.x > 50) { gameState.zone = "danger"; } else { gameState.zone = "safe"; } // Log only on zone change (not every frame) if (gameState.zone !== gameState.previousZone) { console.log("Entered zone:", gameState.zone); gameState.previousZone = gameState.zone; }
  • Define zone boundaries using position coordinates
  • Check player position against zone boundaries each frame
  • Update gameState.zone when crossing boundaries
  • Console log zone changes (trigger only once per crossing, not every frame)
  • Test: walk between all zones and verify detection
  • Checkpoint

    Walking into a new zone prints a message ONCE (no spam). State updates correctly.

    No encounters yet. No battles. No store. Just detection. Systems come Week 3.

    Logging every frame instead of only on zone change — the console fills with thousands of identical messages.

    Wrong boundary coordinates — the zones from Day 9 don't match the detection boundaries.

    Not storing previous zone to detect transitions — without comparing old vs new, you can't detect the moment of crossing.

    This completes the 3D world foundation. After today, both kids have a walkable world with zones. Celebrate this — it's v0.2. Point out how Days 1-5 (design + text prototype) now connect to Days 6-10 (visual world). Next week, the systems merge.

    Both games have a working 3D scene with camera, player movement, defined zones, and zone-based state detection. The stage is set for systems.