20
Alice and Media Computation August 2009 Animation Storyboard Code Steve Cooper Barbara Ericson

Alice and Media Computation August 2009 Animation Storyboard Code Steve Cooper Barbara Ericson

Embed Size (px)

Citation preview

Page 1: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Alice and Media Computation August 2009

Animation

Storyboard Code

Steve CooperBarbara Ericson

Page 2: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Traditional Problem Solving in CS

Read and understand the problem or task specification

Design a solution (develop an algorithm)

Implement (code)

Test

Revise, as needed

Page 3: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Designing a Solution in AliceTo create a design, we borrow the idea of storyboards from professional animators at Disney, Pixar, etc.

Page 4: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Recall….Princess EscapeA princess has been grounded by her

father (a wizard). Being a rather rebellious princess, she has emailed the local dragon taxi service. The dragon will fly to the princess and she will climb aboard the dragon to escape from the castle – to meet some friends at the village dance club.

Page 5: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Visual Storyboards

Page 6: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Textual Storyboard(pseudo code)

Do in order

dragon takes off

dragon flies to princess

princess climbs on dragon's back

dragon and princess escape

knight shakes his arm (and sword) in protest

Page 7: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Implementing a program in Alice Create the program instructions using the drag and drop editor

We recommend an incremental development approach

write a method

test it and so on….

Page 8: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Stepwise refinement - 1

How can a dragon "take off"?Do together

dragon moves up

dragon flaps wings

Do in order

dragon takes off

dragon flies to princess

princess climbs on dragon's back

dragon and princess escape

knight shakes his arm (and sword) in protest

Page 9: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Stepwise refinement - 2

How can a dragon flap its wings?

Do together

dragon flap left wing

dragon flap right wing

Do together

dragon moves up

dragon flaps wings

Page 10: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Stepwise refinement - 3

How can a dragon flap its left wing?Do in order

Do together dragon left wing rolls right dragon left wing flap rolls right

Do togetherdragon left wing rolls leftdragon left wing flap rolls left

Is this too detailed?

Probably, but you get the picture…

Do together

dragon flap left wing

dragon flap right wing

Page 11: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Create the flapWings Method

1. Select dragon

2. create new method

3. Name themethod

Page 12: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

flapWings

Will flap the left wing and the right wing at the same timeSo create a flapLeftWing and a flapRightWing method as wellWrite the flapLeftWing methodDo in order

Do together dragon left wing rolls right dragon left wing flap rolls right

Do togetherdragon left wing rolls leftdragon left wing flap rolls left

Page 13: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

The complete method

Page 14: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Testing flapLeftWing

Page 15: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Your turn!

Create the flapRightWing methodDo in order

Do together

dragon right wing rolls left 0.05

dragon right wing flap rolls left 0.03

Do together

dragon right wing rolls right 0.05

dragon right wing flap rolls right 0.03

Page 16: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Create a flapWings method

Page 17: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Your turn!

Create the flapWings method

Create a takeOff method, where the dragon moves up 2 meters and flaps its wings twice

What changes will you need to make to the duration= parameter to get the animation working?

Page 18: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Create a fly method

Page 19: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Adding Comments

Comments are short descriptions of what is happening

Explain confusing bits

Drag up the // tileClick on the down arrow

Select other

Type the comment

Page 20: Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson

Saving out a new class

Renaming the classFlyingDragon

Saving itRight click on it

Save Object

FlyingDragon.a2c

Importing it for a different worldStart Alice

File-Import the class

FlyingDragon.a2c