11/17/2009
Alice
Program Design and Implementation
Scenarios and storyboards
• The previous magician example illustrated a
simple storyboard which depicts a scenario
• Should come up with the scenario and come
up with a design or “plan ahead” strategy to
construct the program
• Scenario
– What story is to be told?
– What objects are needed? Role vs. background?
– What actions are to take place?
1
11/17/2009
Scenario Example
• Story
– A robot’s first encounter with an alien on a distant
moon
• Objects
– Robot, lunar lander, alien, rocks
• Actions
– Alien peeks out from behind rocks; robot turns its
head and moves toward the alien; the alien hides and
the robot sends a message to earth
• To design this scenario we can use storyboards
Storyboard
• Can be visual or textual
• Breaks down a scenario into sequences of
many short scenarios
– Depicts the sequence of scenes
– For an animation there many be dozens of scene
sketches drawn by animation artists or generated
by computer animation specialists
2
11/17/2009
Example Visual Storyboard
For our purposes, simple
stick figures, square, circles,
other simple shapes will
suffice
From http://accad.osu.edu/womenandtech/Storyboard%20Resource/
Visual Storyboard
• Can plan out with screen captures from Alice
and manually moving objects around
Initial scene; robot has Alien appears and says “Slithy Robot moves toward alien
climbed down the lander and toves?”
is exploring
3
11/17/2009
Textual Storyboards
• Not everyone has the patience for visual sketches;
textual storyboard is a good alternative
• “To-Do List” and prepares us for writing program code
• Example for alien
– Do the following steps in order
• Alien moves up
• Alien says “Slithy Toves?”
• Robot’s head turns around
• Robot turns toward alien
• Do the following steps together
– Robot moves toward the alien
– Robot legs walk
Textual Storyboards
• Evaluate and Revise – storyboard is not final
– Does the action flow from scene to scene?
– Do any transitions need to be added to blend one
scene to the next?
– Is anything missing?
– Should something be changed?
• Design-Modify-Create cycle
4
11/17/2009
Creating a Program
• What instructions are needed for the alien storyboard?
– Do the following steps in order
• Alien moves up
• Alien says “Slithy Toves?”
• Robot’s head turns around
• Robot turns toward alien
• Do the following steps together
– Robot moves toward the alien
– Robot legs walk
• Alien moves down
• Robot turns to the camera
• Robot turns red
• Robot says “Houston, we have a problem!”
To-do In Class
• Program sequential actions for storyboard
– Drag actions into “Do In Order”
• What about moving forward while moving legs
up and down? We want this to happen together
– Drag the “Do Together” block where you would like
things to be done together
• In our case, drag inside the “Do In Order” but this could be
put outside as well
5
11/17/2009
Flowchart
backLeftLeg frontRightLeg
UpperJoint turns UpperJoint turns
Robot moves 2 forward 0.1 forward 0.1
meters
backLeftLeg frontRightLeg
UpperJoint turns UpperJoint turns
backward 0.1 backward 0.1
Can right-click the object to see what the method will do; control-Z to undo
First Attempt
• Do together
– Move robot forward
– Turn backLeftLeg forward 0.1
– Turn backLeftLeg backward 0.1
– Turn frontRightLeg forward 0.1
– Turn frontRightLeg backward 0.1
6
11/17/2009
Second Attempt
• Bug in the previous version, everything done
together, including moving forward and
backward at once
• These should be done in order instead
• Also make sure time adds up to the 2 seconds
for the walking motions
Using a Property
• You can drag the property out to the code
window to change a value at some point in
the program
• Drag the robot’s color property and change it
to Red
7
11/17/2009
Use Comments
• Drag the // to explain what the program is
doing
Motion
• Experiment with
– Turn
– Roll
– Move To
– Turn To Face
– Orient To
• Try putting a beach ball on top of an animal and have the two move
forward together
• Most likely they will not go in the same direction because we can’t tell
which direction the ball is facing
• Solution is to “orient to” the same direction
– Vehicle Property
• Makes one object belong to another so moving the “vehicle” moves
the occupant as well
8
11/17/2009
Arguments: duration, style, asSeenBy
• Duration – self explanatory
• Style – abrupt or gentle motion
• asSeenBy – Defines the directions for forward,
backward, up, down, left, right
– If world, then absolute directions
– If object, relative to whatever direction that object
is facing
– Book example: helicopter go up but banked