PF 102 · Event-Driven Programming · Pre-final
Discussion
01 / 10
edp-lab/README.md
Inside Checkpoint
Pre-final 04 — enter, leave, and explain every event that fired
PF 102 · Pre-final Checkpoint Live demo + paper drill 50 points
What you turn in
Deliverables
DeliverableWhat it is
RepoYour same edp-lab fork URL on GitHub
READMEA My Interiors section (building · enter · exit · what you can do inside)
Commits3+ meaningful commits: enter path, exit path, README
Live demo2–3 minutes: a classmate enters and leaves without you touching the keyboard
Paper drillenterInterior / exitInterior from memory + which events fire them
Hard gates · must pass
Four things that must be true
  • 1Enter and exit are handlers + a mode flag — not a link to a second HTML page
  • 2Double-clicking while already inside does not enter again (state guards the handler)
  • 3The Exit button works without also triggering onClick (check the Event trace)
  • 4You can write enterInterior / exitInterior from memory + one sentence on what fires each
Rubric · 50 points
Points go to events, not 3D art
CriteriaWhat the grader checksPts
EnterDouble-click your building → inside its room10
ExitEsc returns to the island; camera orbits again; badge resets10
Mode guardsNo re-enter inside · R/B/dblclick island-only · midterm click still works10
Mode visibleBadge / HUD shows Island vs Inside: …5
Event flow (CLO3)Explains target vs currentTarget and why Exit must not bubble into onClick5
Git + README3+ meaningful commits · My Interiors section5
Paper drillBoth functions from memory + which events fire them5
Say this in your demo
Fire → Listen → Handle → State
When the user double-clicks the ____ (FIRE), main.js listens with canvas 'dblclick' (LISTEN), events.js runs enterInterior() (HANDLE), and mode becomes 'inside' — you can see it in the badge (STATE).
  • Say it again for Esc and for the Exit button
  • Then show one handler that behaves differently inside (click, R, or animate)
Demo order · 2–3 minutes
Run your demo like this
1 · ISLAND
Show midterm still works
Click selects + names. Point at the badge: Island.
2 · INSIDE
Classmate enters
They double-click your door, look around, click a prop.
3 · OUT
Classmate leaves
Esc, then enter again and use the Exit button. Show the Event trace.
If a classmate can enter and leave without your help, the feature is real.
Paper drill · laptop closed
Write these from memory
function enterInterior(building) — fired by: ______________________ function exitInterior() — fired by: ______________ and ______________
  • Include the guard line in both functions
  • Trace: "I double-click my building. List every handler that runs, in order."
Common fails · fix before you demo
Don't lose points for these
SymptomCause
Double-click shows the island from far awayThe interior: key doesn't match makeInterior('key', …)
Camera keeps orbiting insideanimate() is missing the if (mode === 'inside') branch
Sun glows through the wallsSun/moon sprites not hidden in enterInterior
R or B changes things insideNo if (mode === 'inside') return; after the Escape check
Exit click wipes the HUDClick listener on window instead of the canvas
Still the Cafe from the demoMake your building enterable — renaming the Cafe isn't yours
README
My Interiors
## My Interiors | Building | Enter | Exit | Inside you can… | |---|---|---|---| | Canteen | double-click the canteen | Esc / Exit button | click the counter to see the menu |
  • One row per enterable building
  • Commits: Enter canteen on double-click · Exit on Escape and HUD button · README: My Interiors
Before you submit
Last check
  • ✓All four hard gates pass
  • ✓Console is clean · midterm features still work
  • ✓README My Interiors + 3 commits pushed
  • ✓You can say Fire → Listen → Handle → State for enter and exit
You stepped inside something you made. Questions?
note //