Topic

Today’s topic is the Side Panel in A Dark Room.



Purpose

Learning:how to talk about functions
ADR Project:display text on the Side Panel



Sandbox

Study the table below, which shows the output created by some lines of code.

What do you guess belongs in the ? spots in the table?

CodeOutput
addToPanel("freezing")shows freezing in the panel
addToPanel(3 < 4)shows true in the panel
addToPanel("3 < 4")?
addToPanel(10 > 50)?
addToPanel("10 > 50")shows literally 10 > 50 in the panel
addToPanelAfter(5, "burning")?

Write in your sprint notes…

what you guess belongs in the ? spots in the table above.



Walkthrough

  1. Browse these slides. (push the arrows to make sure you don’t miss any)
  1. Grab the vocab walkthrough paper from the classroom.
  2. Copy the slides onto your paper.
  3. Add your own observations in the Patterns boxes on your paper.

Before continuing:

Make sure your name is on the paper, drop it in the INBOX, then check the box in your sprint notes.



Exercises

Freezing

Approaching

  1. Duplicate this Side Panel Distro Code.
  2. Run the sketch.
  3. Update the code according to the comments below.
// This code shows "cold"
addToPanel("cold");
//
// Change the argument to "freezing".
//
// And remove the now-incorrect comment above that line of code.
//
// For now we're only working inside the definition of the setup() function.
// 
// Call addToPanel three more times with these arguments:
// "the fire is dying"
// "you gather wood"
// "the room will be warm soon"

Before continuing:

Rename the sketch Freezing and save it.

Then write that name in your sprint notes.



Footsteps

Proficient

  1. Duplicate this Side Panel Distro Code.
  2. Run the sketch.
  3. Update the code according to the comments below.
// Still only working inside the definition of the setup() function.
//
// Show these messages 2 seconds apart:
// "footsteps in the distance"
// "getting closer"
// "almost here"
// "at the door"
// "knock"
// "knock"
// "knock"
// "door creaks open"
// "a stranger enters"

Before continuing:

Rename the sketch Footsteps and save it.

Then write that name in your sprint notes.



Stranger

Distinguished

  1. Duplicate this Side Panel Distro Code.
  2. Run the sketch.
  3. Update the code according to the comments below.
// Create this sequence:
// 1. call the addToPanel function with this argument: "a stranger arrives" 
// 2. call the addToPanelAfter function with 2 arguments: 3 and "they carry wood"
// 3. at the same time as the last message, show "light filters in"
// 4. show "darkness falls" 3 seconds after the light filters in

Before continuing:

Rename the sketch Stranger and save it.

Then write that name in your sprint notes.