Parameters Alice. A beetle band Our task is to create an animation for a bug band as an advertisement for their next concert.

Slides:



Advertisements
Similar presentations
As you come in… DOWNLOADS FOR TODAY: Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?
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.
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.
Parameters and World-level methods Alice. Our Dragon world The dragon must to take off and fly, to carry the princess.
Parameters and Event-Handler Methods Alice. Mouse input Interactive programs often allow the user to use a mouse to click buttons in a windows-based interface.
Parameters Alice.
Parameters Section 8-8 Web Design. Objectives The student will: Understand what a parameter is Understand how to use a parameter in Alice Understand how.
Arrays and Array Visualization
Tips & Techniques 6 Random Numbers and Random Motion Alice.
More About Recursion Alice. A second form of recursion A second form of recursion is used when the solution to a problem depends on the ability to break.
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
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.
Programming: Putting Together the Pieces Built-in Functions and Expressions 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.
Arrays and Array Visualization Alice. What is an array? An array is a collection of objects or information that is organized in a specific order. The.
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.
Today’s Agenda 1.Collect Pre-Lab 5 2.Collect Alice project storyboards 3.Events 4.Dummy Objects 5.Assign pair programming teams and meet upstairs for Lab.
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
Parameters and Event-Handler Methods Alice. Mouse clicks Interactive programs often allow the user to mouse click an object in the display. buttons in.
Interactive Programming Sec 49 Web Design. Objectives The student will: Understand the difference between movie mode and an interactive program Understand.
Functions Alice.
Creating An Animation Program Alice. Recall We began the animation creation process We introduced the concept of storyboard We will continue using the.
Variables and Inheritance Part 1
Programming: Simple Control Structures Part 2 – Repetition Alice.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running Types of data.
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: Simple Control Structures
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.
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.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
Creating An Animation Program Alice. Recall We began the animation creation process We introduced the concept of storyboard We will continue using the.
List Search Alice. Common Uses of Lists Iterating through a list of several like items to accomplish the same task with each item. As in the previous.
Parameters Alice. Overview The need for more flexible methods Passing a parameter to a method Demos Using the Alice interface to write code for a parameter.
Parameters MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Parameters Section 8-8 Web Design.
Functions Sec 51 Web Design.
Arrays and Array Visualization
Functions Sec 8-11 Web Design.
Parameters Alice.
Programming: Simple Control Structures
Lists Alice.
Lists Alice.
Creating an Animation Program
Programming: Simple Control Structures
Parameters and World-level methods
Interactive Programming
Programming: Simple Control Structures
Programming: Simple Control Structures
Lists Alice.
Functions Alice.
Lists Alice.
Programming: Simple Control Structures
More About Recursion Alice.
Parameters Alice.
Functions Alice.
Programming: Simple Control Structures
Creating An Animation Program
Class-level Methods and Inheritance
Interactive Programming
Functions Alice.
Functions Alice.
Class-level Methods and Inheritance Part 2
Presentation transcript:

Parameters Alice

A beetle band Our task is to create an animation for a bug band as an advertisement for their next concert.

Storyboards Each bug band member will perform a solo. Do together Do in order georgeBeetle move up georgeBeetle move down play sound Do together Do in order ringoBeetle move up ringoBeetle move down play sound Do together Do in order paulBeetle move up paulBeetle move down play sound Do together Do in order lennonBeetle move up lennonBeetle move down play sound

Demo Ch04Lec2BeetleBand-v1 Concepts illustrated To play a sound, a sound file must first be imported into Alice. ( Alice is not a sound editor.) This code is only for georgeBeetle. Three more methods (one for each band member) will be needed !

A Better Solution Four versions of very similar code seems a bit tedious. The only things that change are the beetle and the music that plays. A better solution is to write a more flexible method.

Parameters Built-in methods provide flexibility by providing parameters such as distance and direction. Parameters allow you to pass in values (arguments). Example Parameters: distance, direction Arguments: 0.5 meters, 0.5 seconds

Kinds of Parameters Alice provides several kinds of parameters that can be used in your own methods.

The storyboard solo Parameters: bandMember, music Do together Do in order bandMember move up bandMember move down play music In this example, we can write just one method and use parameters to specify: which band member is to perform and which music should be played.

Demo Ch04Lec2BeetleBand-v2 Concepts illustrated Enter name and select the type of each parameter bandMember is an Object parameter music is a Sound parameter A parameter acts as a placeholder in the instruction Arguments are passed to the parameter in the call to the method

A Number parameter Add a Number parameter to specify the height the bandMember jumps up and down. Note that the call to the method must now include an argument for the height.

Assignment Read Chapter 4-2 Parameters

Lab Chapter 4 Lec 2 Lab