Functions and Visual Effects Chapter 6 Part 3. Built-in Functions We have been using built-in functions so far 2.

Slides:



Advertisements
Similar presentations
Visual Lists By Chris Brown under Prof. Susan Rodger Duke University July 2012.
Advertisements

Princess & Dragon – Version 2 By Michael Hoyle under the direction of Professor Susan Rodger Duke University July 2012 Part 3: Billboards, Events, Sounds,
Class-level Methods Chapter 6. Class-level Method Is specific to a class of objects We can give a class new abilities/methods Only involves this one class.
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.
Decision Structures Chapter 4. Chapter 4 Objectives To understand: o What values can be stored in a Boolean variable o What sequence structures are and.
Events Chapter 7. Interactivity The real world is interactive User determines order of actions instead of programmer.
Events Chapter 7. Interactive Real world is interactive User determines order of actions instead of programmer.
Skater World: Part Four By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 2009.
Repetition Structures
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Alice: A Visual Introduction to Programming Chapter 1 Part 3.
Programming in Alice Chapter 2. Today’s Agenda Designing a Program Writing Methods Executing Instructions Simultaneously Comments Tips for Setting Up.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Creating Functions Pepper. Homework Asking the user: –Drag variable to create a set statement –Drag a world function NumberDialog or StringDialog over.
Alice: A Visual Introduction to Programming Chapter 1 Part 2.
Programming in Alice Chapter 2 Part 2. Events Editor Identifies what method is executed (run) when the “Play” button is hit 2.
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running o Stored in.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Making a Boat Racing Game in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2010.
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June
Alice: Functions Alice Chapter 6 September 19, 2005.
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.
Decision Structures Chapter 4 Part 2. Chapter 4 Objectives To understand o What relational operators are and how they are used o Boolean logic o Testing.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Creating An Animation Program Part 2 Alice. Method A segment of program code (instructions) that defines how to perform a specific task.
Alice Tips and Techniques. Tips and Techniques I suggest you read the tips and techniques sections at the ends of the chapters. Tells you how to do things.
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.
Alice: A Visual Introduction to Programming Chapter 1 Part 2.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Where are we? Alice is a “toy” language Fundamentals are exactly like “real”
Functions Alice.
Mathematical Expressions, Conditional Statements, Control Structures
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running Types of data.
Programming: Putting Together the Pieces Built-in Questions and Expressions Alice.
Creating a Historical Tour in Alice By Jenna Hayes May 2010.
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.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
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.
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.
1 Quiz Show Programming Terms. 2 Alice - 3D Virtual Programming Vocabulary Quiz Board Chapter 1 Chapter 2a Chapter 2b Chapter 3 Chapter 4 $100 $200 $300.
An Introduction to Programming with Alice Text and Sound in Alice Worlds.
Creating a UFO Rescue Game in Alice
Programming: Putting Together the Pieces Built-in Functions and Expressions Sec 8-5 Web Design.
Skater World: Part Four
Programming: Putting Together the Pieces Built-in Functions and Expressions Sec 8-5 Web Design.
Professor Susan Rodger
Let's Race! Typing on the Home Row
Creating a UFO Rescue Game in Alice
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Learning to Program: Part 3 Camera Control, Invisibility and 3-D Text
Headshots in Alice Duke University Professor Susan H. Rodger
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Functions Alice.
Programming: Putting Together the Pieces Built-in Functions and Expressions Alice.
Presentation transcript:

Functions and Visual Effects Chapter 6 Part 3

Built-in Functions We have been using built-in functions so far 2

How a Function Works A function o Receives value(s) as arguments in parameters o Performs computations on the value(s) o Returns (sends back) a value 3

Types of Functions The function type depends on the type of value it returns Examples o Number o Specific object o Boolean (true or false) o Color o Other property values… 4

Create Function Click on create new function in class or world you want it to be in Name function and choose type of function A blank function will be created with return statement Value will be returned when function is done o Place value you want returned in return statement 5

Function Window Since no action is performed in a function all instructions will be performed in sequential order o No need for Do in order and Do together o All will be Do in order Notice that you can place return elsewhere in function 6

Calorie Example A high school jock wants to know how many calories a cookie has He asks a lunch lady She consults the newly created calorie function o 1 meter wide cookie = 1000 calories Number Function calories Parameter: food Local Number variable: numCalories If food = cookie numCalories = cookie’s width *1000 Return numCalories 7

Algorithm Translated to Alice My first method has jock ask lunch lady for the calories in the cookie The lunch lady checks how many calories with the calorie function and answers with the amount of calories 8

Visual Effects and Animation Billboards Fog Vehicles Pose Programming the Camera Creating Dummy Objects 9

Billboards Graphical images that have been inserted into the world Can insert images that are JPEG, GIF, TIF Known as “Billboard” Images are flat, 2D with height and width no depth Can be used as backgrounds or scenery or used to give info to the viewer! Boy are you shallow, you’re only 2D! 10

Information Billboard Can be used as sign for instructions 11

Creating Billboard Can import images using Make Billboard In File menu 12

Fog Alice can give a look of “mist” to the world The entire world becomes less visible 5-13

Vehicle Property To have two objects move as one One object will be carried by another object o Ex: person on horse  Horse is vehicle for person Choose properties tab o In property of object being carried  In vehicle choose object doing carrying 14

Pose  Once an object has been put into a position or pose, the pose can be restored during an animation o Pose is a property of an object o setPose is a method of an object 15

Programming the Camera Camera can be programmed just like other objects All the same primitive methods and functions are available for it: o Point at, Move, Turn, etc. Camera can also be a vehicle for other objects 16

Creating Dummy Objects Dummy objects are invisible objects that are placed in the world Camera then moves to the invisible object to get different perspectives 17

Homework Read chapter 6 sections 6, 8, 9 Do tutorial 6 and 7 Do lab exercises Answer questions in handout Due one week after assigned with 1 week grace 18