Making Procedural Methods

Slides:



Advertisements
Similar presentations
Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
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.
PIIT Computer Science Summer Camp - Alice July 11, 2012 Brenda Parker Computer Science Department MTSU.
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
1 ADVANCED MICROSOFT POWERPOINT Lesson 5 – Using Advanced Text Features Microsoft Office 2003: Advanced.
Lights Camera Action! Part 3: BDE Events By Deborah Nelson under the direction of Professor Susan Rodger Duke University July 2008.
End and Start of Year Administration Tasks. Account Administration Deleting Accounts Creating a Leavers Group Creating New Accounts: Creating accounts.
Using Microsoft Outlook: Basics. Objectives Guided Tour of Outlook –Identification –Views Basics –Contacts –Folders –Web Access Q&A.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Microsoft Office Illustrated Fundamentals Unit B: Understanding File Management.
23 Copyright © 2004, Oracle. All rights reserved. Sharing Objects and Code.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Programming Logic Program Design. Objectives Steps in program development Algorithms and Pseudocode Data Activity: Alice program.
Lesson 2 – Formatting Text Microsoft Word Learning Goals The goal of this lesson is for the students to successfully apply formatting to a document.
Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
? Back Next INTRO. ? Back Next INTRO Main Menu What is Mail Merge? Slide 2 Purpose of Mail Merge Slide 3 Mail Merging Certificates Slide 5 Help Slide.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
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.
The Essentials of Alice Mrs. Jayne Slease SBMS CTE Computer Science and Animation Credit to Duke Students under the direction of Professor Susan Rodger.
Headshots in Alice Duke University Professor Susan H. Rodger Gaetjens Lezin July 2008.
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events By Elizabeth Liang under the direction of Professor Susan Rodger Duke University June.
Unit 2 Programming in Alice & Java 1. Day 1: Learning to Program  Objective: Understand the need for step-by-step logic; Basic working of a computer.
Perform a complete mail merge Lesson 14 By the end of this lesson you will be able to complete the following: Use the Mail Merge Wizard to perform a basic.
MIS 3200 – C# (C Sharp)
Development Environment
CUS POWERPOINT PRESENTATION
Working in the Forms Developer Environment
Configuring Applications
Getting started in Alice
Putting Objects in Motion
Changing Camera Views! Part 1: Set Point of View to By Bella Onwumbiko
Classes, Objects, and World-level Methods
UNIT 3 – LESSON 5 Creating Functions.
Making Objects Move in Unison: Using Lists
Control Structures
Introduction to Events
© Paradigm Publishing, Inc.
1004 Enclosure and Life Support Management
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Programming using Alice 3
Lesson 5 Formatting a Presentation
Lesson 5 Formatting a Presentation
Classes, Objects, and World-level Methods
Making Objects Move in Unison: Using Lists
Lesson 5 Formatting a Presentation
Class-level Methods Alice.
Arrays
Princess & Dragon Part 2: Teaching a Dragon to Fly—Methods & Properties By Elizabeth Liang under the direction of Professor Susan Rodger Duke University.
Lesson 5 Formatting a Presentation
Using Functions
Using Parameters
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events
Object-Oriented Programming: Inheritance and Polymorphism
Introduction to Object-Oriented Programming in Alice
Using Templates and Library Items
Getting Started With Alice
Learning to Program: Part 3 Camera Control, Invisibility and 3-D Text
Tutorial for Arrays and Lists
Headshots in Alice Duke University Professor Susan H. Rodger
Classes / Objects / Methods
Using Placeholders to Simplify your Methods: Learning Methods, Part 2
Microsoft Office Illustrated Fundamentals
Using Microsoft Outlook: Outlook Support Number
Word Masterclass By Dan Carline.
Presentation transcript:

Making Procedural Methods http://www.alice.org/resources/lessons/making-procedural-methods/

What is a Method?

What is a Method A method is a small defined (named) set of instructions within your program that defines a task to be performed.

There are two types of methods in Alice What is a Method There are two types of methods in Alice Procedural Methods - directions for how the environment or objects in the environment should behave such as “move forward” Functional methods – directions for getting information from the environment, objects, or the user such as “how far is the rabbit from the carrot?”

What is a Method Built In Procedures Alice has a number of methods built into it that are constructed to make animation easy. The built in procedures cover the basics of: Moving objects in all the different directions Orienting or rolling and turning objects Orienting objects to each other Changing the environment (fog, sound, lighting) 5

What is a Method User Generated Procedures Users may want to create their own to procedures to: Create reusable animations for specific characters or classes Simplify the level of detail to help organize and maintain their program Share procedures between projects 6

What is a Method Hierarchy and Inheritance Alice is object oriented so procedure are associated with objects (classes). Inheritance means that methods defined for parent classes are inherited by the child classes. In Alice the major factor that determines the hierarchy of inheritance and the ability for methods to be used on parent and child classes is the underlying joint structure. All of the bipeds share the same basic joint structure so teaching one biped such as Thor to walk could be shared with all bipeds, however the same method would make no sense to a clown fish or swimmer because they wouldn’t have the same joints.

Why Use Them?

Why Use Methods Abstraction To use an abstracted method you only need to know what it does and how to use it but not how it works. Alice built in procedures and functions are examples of abstracted methods that are designed to be helpful and very easy to use but for you to use them you don’t need to understand how they are constructed. Abstraction also allows you to create different levels of complexity in your program. At the top level you may want to establish the larger acts of your animation or levels of your game. To keep this easier to manage and follow you may build more detail inside custom methods of the scene or within the class and object levels. This use of abstraction can help you organize the functionality and structure of your program.

Why Use Methods Alice Built In Procedures Alice built in procedures are an example of Abstraction. These methods make it easy for you to make use of functions such as say without having to see the level of detail that is needed to construct it such as: Select Location Select font Select Line Weight Input desired text Draw on Screen To use this method you don’t need to understand everything that is needed to make it work.

Why Use Methods Reusability Once you have constructed a method it can be used over and over again. You can invoke the same method as many times as you want in your program. This will save you lots of time when building your project. Another aspect of reusability is that a single method can be used in several different (and separate) projects. When you need to write a new program, you can go back to your old programs, find the methods you need, and reuse those functions in your new program. You can also use methods that somebody else has written.

Why Use Methods Thor Greeting His Guests

Why Use Methods Debugging and Editing Using reusable methods in multiple places makes it possible to easily maintain the original method. You can make edits to that original method and have that change reflected everywhere that your program uses that method without having to find and replace all instances of the change. Separating your program into smaller methods also makes it easier to find partitions of your code to debug problems. Instead of reading through a long program looking for the problem code you can easily navigate to the area of code that you want to focus on.

Why Use Methods Howdy is Better

Creating New Procedures

Creating a Procedure Adding a New Procedure There are two places you can add a new procedure Click on the class drop down menu and navigate to the location you want to create it and select add a procedure Navigate to the Class summary page and select add new procedure in the procedures list

Creating a Procedure New Procedure Hierarchy Alice is object oriented so you can add a new procedure to different objects (classes). Things to consider when deciding where to add them: Scene (Highest) - Will allow you to add and manipulate all objects (including scene properties) Gallery Class (Biped) - You will be able to reuse them by all objects that share the same characteristics (joint structure) Object Type (Thor) - You will only be able to use it with that object type but you can access all unique joints or functions associated with that object

Creating a Procedure Naming Conventions Be sure to give it a name that easily communicates to anyone reading your code what it will do Begin with lowercase letter of the alphabet May include digits No spaces, use camelCase if more than one word No special characters such as ‘?’ or ‘#’

Creating a Procedure Accessing the New Procedure Once you have created your new procedure there are multiple ways to access it to edit Select it from the drop down class menu Select it from the list of procedures on the class summary page Select edit next to the procedure on the method pane Right click on the procedure in the code editor and select the procedure folder

Creating a Procedure “This” is a Placeholder Don’t be confused by the use of “This”. When viewing the procedure remember that the procedure you are writing could be used by any number of objects depending on where you put it. At the biped level “this” could be any object of the biped type that you add such as Loki or Odin At the Thor level “this” could be any number of Thor characters - remember that you could have a whole army of Thors running around

Creating a Procedure Build Your Procedure You can now make your procedure using all of the different functionalities available in Alice.

Creating a Procedure Procedure is Ready to Use Your procedure is now ready to be used. You will see it in the procedures tab of the code editor when the appropriate objects are selected. Remember you can use it as often as you like and make edits that will automatically propagate to all uses of that method.

Sharing Custom Procedures

Sharing Custom Procedures Exporting and Importing Class Files You can share procedures between projects by saving out and then importing the whole class file. Navigate to the class summary tab that contains the methods you desire to share Select Save to Class File The default will name the file the class name and save to your MyClasses folder

Importing Class Files Sharing Custom Procedures To import the class file you will need to first add an object of the class type to your scene Navigate to the class summary tab that you wish to import class information for Select add from class file Select the class file that you want to add to your project

Sharing Custom Procedures Merging Class Files You can decide what methods you want to import from the merge dialogue box Check and Uncheck your desired imports Select Finish and you will see the desired methods populated in your new project

Tips and Tricks

Tips and Tricks Using the Clipboard Many times you may realize after you have made something that you will want to use it over and over again. If this happens to you: Create your new custom method Drag the code you want to move to the clipboard Navigate to your new method and drag the code out of the clipboard The clipboard doesn’t make a copy so if you want the code to remain in the original location make a copy first then drag to the clipboard