Alice: Program Design and Implementation
Alice: Program Design and Implementation
Alice
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
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
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?
To-do In Class
• Program sequential actions for storyboard
– Drag actions into “Do In Order”
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
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