DOC PREVIEW
Duke CPS 004 - Chap 2 Sec 2

This preview shows page 1 out of 4 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 4 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 4Chap 2 Sec 2Sep. 13, 2005Prof. Susan RodgerNote: Thanks to Wanda Dann and Steve Cooper for slide ideas.Announcements• Skip Chapter 3• Read Chapter 4, Section 1• Assignment 3 out– Storyboard due next Tues– World due Thurs• Blackboard• Put on web pageWhat we will do today• Lecture on Chap 2, Sec 2• Classwork – Create several animations•Snowman• Monkey and ball• Chicken and horse• Boat pointing to island•others– Following along in text, some additions–Exercises– Get checked offLast Time• Began the animation process– Storyboards• We will continue using the alien example from last time• Show alien animationStep 2: Implementation• Implementing an animation requires– Setting up the initial scene in Alice– Writing the Program (script)Create the Initial SceneTechniques and Tools• Mouse used to– Setup the initial scene– Approximately position objects in the scene– Resize objects• Camera Navigation is used to – Set the camera point of view• Scene Editor’s Quad View – Position one object relative to another objectWriting a Program• “Writing” a program (script)– A list of instructions to have the objects perform certain actions in the animation• Our planned storyboard (todo list) isAlien appears and talks.Robot turns to face alien, moves forwardAlien drops down out of sight.Robot faces camera, turns red and says “we have a problem”• Now translate design steps to program instructionsTranslating the Design• Some steps in the storyboard can be written as a single instruction– robot turns to face alien• Other steps are composite actions that require more than one instruction– Alien appears and speaks• Alien moves up above the rock• Alien says somethingActions• Sequential – Some actions occur one after the other• First: aliens moves up above the rock• Second: alien says something• Simultaneous– Some actions occur at the same time• Robot moves forward while some of its legs moveAction blocks in AliceCoding the robot program• Things to note:– Nesting of DoTogether and DoInOrder blocks– Arguments for the move instruction – direction, distanceTesting• Important step in creating a program – run it be sure it does what you expect it to do• Recommend you use incremental development– Write a few lines of code and then run it– Write a few more lines and run it– Write a few more lines and run it• This process allows you to find any problems and fix them as you goComments• While Alice instructions are easy to understand, it is often desirable to be able to explain (in words) what is going on in a program• Use comments to explain to the human reader what a particular section of code doesComments use //• Comments appear in green• Alice ignores comments• Comments make the program easier to readComments (cont)• Comments can describe a large block of program code• Comments can describe a small subsection of program code• Show monkey, chicken and boat animations•


View Full Document

Duke CPS 004 - Chap 2 Sec 2

Documents in this Course
Lecture

Lecture

18 pages

Chapter 7

Chapter 7

18 pages

Chapter 9

Chapter 9

15 pages

Java 1

Java 1

24 pages

Java 3

Java 3

11 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

28 pages

Chap 2

Chap 2

16 pages

Graphics

Graphics

20 pages

Lecture

Lecture

12 pages

HTML

HTML

16 pages

Java 1

Java 1

6 pages

Chapter 4

Chapter 4

16 pages

The Plan

The Plan

25 pages

Lecture

Lecture

16 pages

Chapter 6

Chapter 6

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

23 pages

Lecture

Lecture

16 pages

Lecture

Lecture

19 pages

Lecture

Lecture

12 pages

Lecture

Lecture

5 pages

Lecture

Lecture

26 pages

Lecture

Lecture

16 pages

Chapter 7

Chapter 7

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

4 pages

Lecture

Lecture

4 pages

Lecture

Lecture

8 pages

Lecture

Lecture

4 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

32 pages

Java

Java

4 pages

CompSci 4

CompSci 4

18 pages

Lecture

Lecture

26 pages

CompSci 4

CompSci 4

12 pages

HTML

HTML

17 pages

Lecture

Lecture

16 pages

Chapter 5

Chapter 5

22 pages

Lecture

Lecture

4 pages

Chapter 4

Chapter 4

10 pages

Chapter 2

Chapter 2

15 pages

Chapter 8

Chapter 8

14 pages

Lecture

Lecture

15 pages

Load more
Download Chap 2 Sec 2
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chap 2 Sec 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chap 2 Sec 2 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?