Alice in Action with Java

Slides:



Advertisements
Similar presentations
Alice.
Advertisements

Class-level Methods Alice. World / Class Method World method A general method that may refer to multiple objects; not closely associated with any particular.
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
1 Alice: Beyond the Basics Steve Cooper Michelle Venable-Foster Barbara Ericson May 2007.
1 Introduction to Word Chapter 3 Lecture Outline.
1 Alice: Beyond the Basics Steve Cooper Michelle Venable-Foster Barbara Ericson Aug 2009.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Alice in Action with Java
Alice in Action with Java
What is Alice? Graphical Programming Environment and Language Learn object oriented programming using 3 dimensional objects and a story telling approach.
Creating And Maintaining A Database. 2 Learn the guidelines for designing databases When designing a database, first try to think of all the fields of.
Alice in Action with Java
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Programming Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
Microsoft Office 2003 Illustrated Brief Document Creating a.
Events (2) (Alice In Action, Ch 6) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
XP New Perspectives on Microsoft Access 2002 Tutorial 21 Microsoft Access Tutorial 2 – Creating And Maintaining A Database.
Teaching a character to walk in more than one world: Parameters and Inheritance. By Lana Dyck under the direction of Professor Susan Rodger Duke University.
© Paradigm Publishing, Inc Access 2010 Level 2 Unit 2Advanced Reports, Access Tools, and Customizing Access Chapter 6Using Access Tools and Managing.
Introduction to Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland Slides Credit: Joel Adams, Alice in Action CS120 Lecture August,
Storyboarding1 Steve Cooper Barb Ericson August 2009 Storyboarding.
Flow Control: boolean expressions, “if” selection statements (Alice In Action, Ch 4) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September.
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1,
3D Animation Concepts CS0007 George Novacky. Overview Creating a new world (slides 5 – 13) Remembering camera position (slides )
Making Billboards By Deborah Nelson Duke University, Under the direction of Professor Susan Rodger, July 14, 2008.
Alice in Action with Java Chapter 5 Lists and Arrays.
Review for test! Alice Chapter 1&2 Test is tomorrow! - March 26 th March 25th.
Variables (Alice In Action, Ch 3) Slides Credit: Joel Adams, Alice in Action CS120 Lecture 04 7 September 2012.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Methods (part 2) Alice In Action, Ch 2 Slides Credit: Joel Adams, Alice in Action CS 120 Lecture 03 4 September 2012.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)
Alice in Action with Java Chapter 4 Flow Control.
Programming in Alice IT-IDT-9 Design, develop, test and implement programs using visual programming. 9.1 Utilize drag and drop software to develop programs.
Methods (part 1) Alice In Action, Ch 2 Slides Credit: Joel Adams, Alice in Action CS120 Lecture August 2012.
Alice in Action with Java Chapter 4 Flow Control.
Presenter: Carol Liss Timberlane Regional Middle School 6 th and 7 th grade Tech. Educator Co presenters:
Alice in Action with Java Chapter 1 Getting Started with Alice.
Making Billboards By Deborah Nelson Duke University, Under the direction of Professor Susan Rodger, July 14, 2008.
Setting Up the Initial Scene. Problem Solving in Alice Set up the initial scene in a new world The princess example Setting up the initial scene.
Functions (Alice In Action, Ch 3) Slides Credit: Joel Adams, Alice in Action CS 120 Lecture September 2012.
Alice in Action with Java Chapter 2 Methods. Alice in Action with Java2 Objectives Build world-level methods to help organize a story into scenes and.
Under the direction of Susan Rodger
Creating a UFO Rescue Game in Alice
Setting Up the Initial Scene
Alice Learning to program: Part Three Camera Control, Invisibility, and 3-D Text By Ruthie Tucker and Jenna Hayes, Under the direction of Professor Rodger.
Getting started in Alice
Microsoft Windows 7 - Illustrated
Programming Logic Alice.
Creating a UFO Rescue Game in Alice
Alice in Action with Java
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
MODULE 7 Microsoft Access 2010
Class-level Methods Alice.
“Keep looking up…that’s the secret of life.”
“It is only those who never do anything who never make mistakes.”
Alice in Action with Java
Making Procedural Methods
Alice: Beyond the Basics
Chapter 2: Programming in Alice
Agenda: 1) Quick Write 2) Finish Questions Ch
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
The work of moving ice Chapter 8 Animated snow scene (Difficult)
Microsoft Office Access 2003
An Introduction to Programming Using Alice 2.2, Second Edition
Introduction to Object-Oriented Programming in Alice
Introduction to Word Chapter 3
Headshots in Alice Duke University Professor Susan H. Rodger
Guidelines for Microsoft® Office 2013
Presentation transcript:

Alice in Action with Java Chapter 2 Methods

Objectives Build world-level methods to help organize a story into scenes and shots Build class-level methods to elicit desirable behaviors from objects Reuse a class-level method in multiple worlds Use dummies to reposition the camera for different shots within a scene Understand how an object’s position, orientation, and point of view are determined Alice in Action with Java

Methods Programs consist of a set of statements Method: behavior-producing message Objects have predefined methods for basic tasks Methods may also be created by Alice developers Two reasons for building your own methods To organize your story into more manageable pieces To provide an object with additional behaviors Alice in Action with Java

World Methods for Scenes and Shots Scene: segment of a story Shot: part of a scene from a given camera position User stories can be divided into scenes and shots A convenient technique for completing a project Divide and conquer approach to building user stories Break a big problem into smaller problems Solve each of the smaller problems Combine the smaller problems into a solution Alice in Action with Java

Methods for Scenes Scenario: develop a user story with three scenes Convention for naming methods Name should be a verb or verb phrase Name should describe what the method does Creating the first new method Select the world object Click the create new method in the details area Enter playScene1 in the New Method dialog box Check new method by sending say() to ground First test fails because my_first_method() is empty Alice in Action with Java

Methods for Scenes (continued) Alice in Action with Java

Methods for Scenes (continued) Alice in Action with Java

Methods for Scenes (continued) How to fix the first bug Click on the tab for my_first_method Drag a doInOrder control to the top of the pane Click on world in the object tree Drag playScene1() into the doInOrder statement Extend technique used to build playScene1() Add two methods: playScene2(), playScene3() New method sends a say() message to the ground New Methods are called in my_first_method() Alice in Action with Java

Methods for Scenes (continued) Alice in Action with Java

Methods for Scenes (continued) Alice in Action with Java

Methods for Shots Scenes can be divided into shots Shots can be further divided into pieces Reasons for using scenes, shots, and pieces To create a program that reflects the user story To create a program that has a modular design Example of a scheme using scenes and shots Level 1: my_first_method() Level 2: three methods for three scenes Level 3: four methods for four shots in Scene 2 Alice in Action with Java

Methods for Shots (continued) Implementing the scheme Test each shot in Scene 2 using a say() method Call the four shot methods from playScene2() Call three scene methods from my_first_method() Structure diagram reflects organization of user story All objects added to world become part of world Scene and shot messages are stored in the world World method: affects behavior of multiple objects Alice in Action with Java

Methods for Shots (continued) Alice in Action with Java

Methods for Shots (continued) Alice in Action with Java

Object Methods for Object Behaviors Object method: defines behavior for a single object Illustration: flapWings()should be sent to a dragon Comments: explanatory remark ignored by Alice Example 1: Telling a Dragon to Flap its Wings Add a dragon object to the world Select dragon from object tree and click methods tab Click create new method and enter flapWings Send roll() messages to each of the dragon’s wings Invoke flapWings() from my_first_method() Add comments to the flapWings() method Alice in Action with Java

Object Methods for Object Behaviors (continued) Alice in Action with Java

Object Methods for Object Behaviors (continued) Alice in Action with Java

Object Methods for Object Behaviors (continued) Example 2: Telling a Toy Soldier to March Four actions correspond to four steps for march() 1 marchLeft; 2 marchRight; 3 marchRight; 4 marchLeft. Define marchLeft() and marchRight() methods These methods produce reverse behaviors Incorporate new methods into march() Call march()four times from my_first_method() Alice in Action with Java

Object Methods for Object Behaviors (continued) Alice in Action with Java

Object Methods for Object Behaviors (continued) Alice in Action with Java

Alice Tip: Reusing Your Work Copy and past techniques speed up development How to use make copy to duplicate statements Right-click bar in editing area containing method Select make copy Example using make copy Refer to my_first_method() in Toy Soldier program Copy three march() statements from first march() Alice in Action with Java

Alice Tip: Reusing Your Work (continued) Alice in Action with Java

Using the Clipboard Alice clipboard Used to copy and paste all statement types Located in the events area Using Alice clipboard in Toy Soldier program Drag doInOrder in my_first_method() to clipboard Create scene1() method Drag statement in clipboard to editing area Drop statement in the scene1() method Only one statement may be placed in the clipboard You can increase the number of available clipboards Alice in Action with Java

Using the Clipboard (continued) Alice in Action with Java

Using the Clipboard (continued) Alice in Action with Java

Reusing an Object in a Different World Alice lets you reuse objects in different worlds Reusing operation involves save and import tasks How to save the dragon object Rename the dragon object flappingDragon Right-click flappingDragon, select save object… Navigate to appropriate storage location in the directory Click the Save button How to import an object into a new world Open new world and choose Import from File menu Navigate to object location and select .a2c file Alice in Action with Java

Reusing an Object in a Different World (continued) Alice in Action with Java

Reusing an Object in a Different World (continued) Alice in Action with Java

Alice Tip: Using Dummies Review Scenes comprise shots Shots are filmed with the camera in a given position Alice places a camera object in every world Two techniques for shifting position of camera Use set of motion-related messages, such as move() Use an invisible marker called a dummy Alice in Action with Java

Dummies Dummy: invisible marker with a point of view Dummies are used to change a camera’s position Description of a scene that will use dummies Wizard intervenes to prevent trolls from taking a castle Camera changes position for each of three shots Story conforms to structure in Figure 2-11 (less Shot 4) Setting up the first shot of Scene 2 Add castle, wizard, and trolls to build the scene Click more controls button and then drop a dummy Go to object tree and rename dummy scene2Shot1 Alice in Action with Java

Dummies (continued) Alice in Action with Java

Dummies (continued) Alice in Action with Java

Dummies (continued) Setting up the second shot of Scene 2 Using camera controls, zoom in on the wizard Press the drop dummy at camera button Rename the second dummy, scene2Shot2 Setting up the third shot of Scene 3 First dummy will be reused for this shot After dummies are inserted they will be programmed Alice in Action with Java

Dummies (continued) Alice in Action with Java

Using setPointOfView() to Control the Camera obj.setPointOfView(obj2) Changes the position of obj to obj2 Example: camera.setPointOfView(aDummy) Adding code to the first shot of Scene 2 Drag a doInOrder statement to the editing area Click on camera object in the object tree Drag setPointOfView()to the editing area Select scene2Shot1 dummy as target and 0 duration Add say() statements for each of the trolls Add a comment to explain the purpose of the method Alice in Action with Java

Using setPointOfView() to Control the Camera (continued) Alice in Action with Java

Using setPointOfView() to Control the Camera (continued) Alice in Action with Java

Using setPointOfView() to Control the Camera (continued) Adding code to the second shot of Scene 2 Set the opacity of the wizard to 0 in properties pane Drag wizard’s opacity property to editing area Set the opacity to 1 in the set() method Set the camera’s point of view to scene2Shot2 Add a say() statement for the wizard Adding code to the third shot of Scene 2 Reset camera’s point of view to scene2Shot1 Point the three trolls at the wizard Set message’s onlyAffectYaw attribute to true Alice in Action with Java

Using setPointOfView() to Control the Camera (continued) Alice in Action with Java

Using setPointOfView() to Control the Camera (continued) Alice in Action with Java

Thinking in 3D Learn about 3D movement to work in Alice Object’s position Determines object’s location in the 3D world Object’s orientation Determines the way an object is facing Alice in Action with Java

An Object’s Position Three axes are used to define the world space LEFT-RIGHT (LR): world’s width dimension UP-DOWN (UD): world’s height dimension FORWARD-BACKWARD (FB): world’s depth Three values specify object’s position in the world lr: point along the LR axis ud: point along the UD axis fb: point along the FB axis Change an object’s position using move() Directional values given with respect to object’s axes Alice in Action with Java

An Object’s Position (continued) Alice in Action with Java

An Object’s Position (continued) Alice in Action with Java

An Object's Orientation Combines yaw, pitch, and roll (provides direction) Yaw: amount of object’s rotation about the UD-axis Example: turn(RIGHT, 0.25) Pitch: amount of object’s rotation about the LR-axis Example: turn(FORWARD, 0.25) Roll: amount of object’s rotation about the FB-axis Example: roll(LEFT, 0.25) Alice in Action with Java

An Object's Orientation (continued) Alice in Action with Java

An Object's Orientation (continued) Alice in Action with Java

An Object's Orientation (continued) Alice in Action with Java

Point of View Combines object’s position and orientation Six values in point of view: [(lr, ud, fb),(yaw, pitch, roll)] Six values correspond to six degrees of freedom Methods used to change six values move(), turn(), and roll() Method used to change point of view setPointOfView() Alice in Action with Java

Summary Divide and conquer approach: decomposing a user story into scenes and shots Define methods to support modular design and provide advanced operations World methods: messages sent to the world Object methods: define a behavior for a single object Comments: remarks that explain program statements Alice in Action with Java

Summary (continued) Alice clipboard: stores a copy of any statement Dummy: invisible marker with position and orientation (a point of view) Object’s position: location specified using three coordinate axes Object’s orientation comprises yaw, pitch, and roll An Alice object has six degrees of freedom Alice in Action with Java