CSC1401 Animation Creating methods/instructions (class-level)

Slides:



Advertisements
Similar presentations
Princess & Dragon – Version 2 By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Part 2: Using Methods.
Advertisements

CS320n –Visual Programming Class-level Methods and Inheritance – Part 1 Mike Scott (Slides 4-3-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger.
Class-level Methods Alice. World / Class Method World method A general method that may refer to multiple objects; not closely associated with any particular.
Class-level Methods and Inheritance Part 1 Alice.
Review of Chapter 4 Sections 1 and 2 World-level methods involve two or more objects break a large problem into smaller, logical units follow a design.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Class-level Methods and Inheritance MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Alice and Media Computation August 2009 Animation Storyboard  Code Steve Cooper Barbara Ericson.
Parameters and World-level methods Alice. Our Dragon world The dragon must to take off and fly, to carry the princess.
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Alice Methods and Classes. Methods and Classes Methods – Coordinated sequence of instructions carried out when requested (e.g. move, turn to, etc.) Class.
Lesson 7B Creating Our Own Methods Slides are adapted from aliceprogramming.net or
World-level Methods with Parameters Alice. Larger Programs As you become more skilled in writing programs, you will find that your programs quickly begin.
Fall 2008ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
Classes, Objects, and World-level Methods Alice. Programming in Alice© 2006 Dr. Tim Margush2 Class / Object Class A template describing the characteristics.
Alice Learning to program: Part Two by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008.
Creating An Animation Program Alice Web Design Section 8-4.
Classes, Objects, and World-level Methods
Today’s Agenda 1.Collect Pre-Lab 4 2.Alice Programming Assignment Storyboards 3.Classes 4.Objects 5.Methods 6.Assign pair programming teams and meet upstairs.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Classes, Objects, and World-level Methods Section 47 Web Design.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Storyboards in Alice Summer 2010 Prof. Susan Rodger.
Class-level Methods Chapter 6 part 1. Classes and Objects Classes o In Alice, classes are predefined as 3D models Objects o An object is an instance of.
Creating An Animation Program Part 2 Alice. Method A segment of program code (instructions) that defines how to perform a specific task.
Alice Program Design and Implementation. Scenarios and storyboards The previous magician example illustrated a simple storyboard which depicts a scenario.
Functions Alice.
Classes, Objects, and World-level Methods Alice. Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase.
Creating An Animation Program Alice. Step 1: Design Decide on the problem to be solved Design a solution We will use a storyboard design technique, commonly.
Storyboarding1 Steve Cooper Barb Ericson August 2009 Storyboarding.
Creating An Animation Program Alice. Recall We began the animation creation process We introduced the concept of storyboard We will continue using the.
Alice Learning to program: Part Two Writing Your Own Methods by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University,
3D Animation Concepts CS0007 George Novacky. Overview Creating a new world (slides 5 – 13) Remembering camera position (slides )
CompSci 4 Chap 4 Sec 1 Sept 15, 2005 Prof. Susan Rodger.
CS320n –Visual Programming Classes, Objects, and World- Level Methods Mike Scott (Slides 4-1)
Classes, Objects, and World-level Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Functions Sec 8-11 Web Design. Objectives The Student will: Understand what a function is Know the difference between a method and a function Be able.
Fall 2009ACS-1805 Ron McFadyen1 Chapter 2 Program Design & Implementation.
Storyboarding and Program Design Alice. Step 1: Design Decide on the problem to be solved Design a solution We will use a storyboard design technique,
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Functions, Loops, and Parameters.
Methods (part 2) Alice In Action, Ch 2 Slides Credit: Joel Adams, Alice in Action CS 120 Lecture 03 4 September 2012.
Questions Alice. Functionality A question receives value(s), performs some computation on the value(s), and returns (sends back) a value.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 2 Creating Your First Animation (An Introduction to Programming)
World-level Classes Chapter 6 Part 2. Programs Grow Program code grows larger over time This makes it more difficult to read and process the code in our.
Animation Programs: Scenarios and Storyboards Alice.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Lesson 8C Animation and Events. Step 3: Animation Drag it into the method and have him say “let her go!” Click on the knight in the object tree and scroll.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events By Elizabeth Liang under the direction of Professor Susan Rodger Duke University June.
Designing a Solution in Alice To create a design, we borrow the idea of storyboards from professional animators at Disney, Pixar, etc.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Alice the Free, Fun and Easy Way to Introduce Students to Programming Elaine Witkowski and Jill Nelson.
Animation Storyboard Design
Classes, Objects, and World-level Methods
Setting Up the Initial Scene
Parameters Section 8-8 Web Design.
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
Classes, Objects, and World-level Methods
World-level Methods with Parameters
Alice and Media Computation August 2009
Classes, Objects, and World-level Methods
Class-level Methods Alice.
Creating an Animation Program
Classes, Objects, and World-level Methods
Parameters and World-level methods
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Classes, Objects, and World-level Methods
Class-level Methods and Inheritance
Presentation transcript:

CSC1401 Animation Creating methods/instructions (class-level)

Recall…. Princess Escape A princess has been grounded by her father (a wizard) and kept inside the castle. Being a rather rebellious princess, she has ed 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.

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

In our programs, we have been using… Classes In Alice, classes are predefined as 3D models Objects An object is an instance of a class. Class: Frog (Uppercase name) Objects: frog, frog1, frog2, frog3 (lowercase names)

We have also used… built-in (predefined) methods Examples: move, turn to face, say World.my first method Example: In the Dragon world, we wrote program code where a dragon took off (as the first step in our animation). All the program code was written in this one method, see next slide…

Larger Programs As you become more skilled in writing programs, you will find that programs quickly increase to many, many lines of code. Games and other "real world" software applications can have thousands, even millions of lines of code.

Potential Problem The program code just seemed to grow and grow. If we continue to write programs this way the programs will become longer and more difficult to read and think about.

Solution A solution is to organize the instructions into smaller tasks.

Stepwise Refinement The process of breaking a problem down into large tasks and then breaking each task down into simpler steps is called stepwise refinement. Once the storyboard is completed, we write a method for each task.

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

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

Stepwise refinement - 3 How can a dragon flap its left wing? Do in order Do together dragon close left wing rolls right dragon far left wing rolls right Do together dragon close left wing rolls left dragon far left wing rolls left Do together dragon flap left wing dragon flap right wing

Demo: Create a class-level method

Drag the code into the editor

The complete method

Calling a method

Demo Create the flapLeftWing method Create an analogous flapRightWing method

Create a flapWings method

Demo 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?

Summary Why do we want to write our own methods? saves time -- we can call the method again and again without reconstructing code reduces code size – we call the method rather than writing the instructions again and again allows us to "think at a higher level" can think surprise instead of “The alien moves up and says ‘Slithy toves?’ and then the robot's head turns around. " the technical term for "think at a higher level" is "abstraction"

Summary: Classes, Objects, & Methods Object-oriented programming uses classes, objects, and methods as basic programming components. These components help to organize a large program into small modules design and think about an intricate program find and remove errors (bugs)

Assignment Read Chapter 4, Section 3 Class-level Methods How to create them How to call them