Parameters MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded.

Slides:



Advertisements
Similar presentations
Learning to Program With Alice
Advertisements

As you come in… DOWNLOADS FOR TODAY: Alice Project: Wanda Dann and Don Slater, CMU What do you still need (Alice content/understanding)?
Alice.
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 Alice.
Don Slater Wanda Dann
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.
Alice Programming Step 1:Design Copyright 2011 Wanda Dann, Don Slater, Steve Cooper.
Arrays and Array Visualization
CS320n –Visual Programming Random Numbers and Random Motion (Slides 6-3) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Tips & Techniques 6 Random Numbers and Random Motion Alice.
Using the Alice 3D Environment to Teach Multimedia Programming Chris Stein BMCC Jody Culkin BMCC CUNY IT Conference Dec. 06.
Copyright 2011 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Problem Solving with Alice 2 & Friends.
Copyright 2011 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Implementation Algorithm  Code World.my first method Control blocks Statements (methods,
Programming: Simple Control Structures Alice. Control Statements We have been using Do in order and Do together to control the way instructions are executed.
Recursion1 Stephen Cooper Wanda Dann Randy Pausch Barb Ericson Jan 2010 Recursion in Alice.
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.
CRA – CDC Duke Summer Internship 2008 Adventures in Alice Programming for Grades Gaetjens Lezin Professor Susan H. Rodger Duke University.
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.
Alice Programming Step 1:Design Copyright 2011 Wanda Dann, Don Slater, Steve Cooper.
An Innovative Approach with Alice for Attracting K-12 Students to Computing Susan H. Rodger Duke University IBM University Days May 7, 2007 Supported by.
Parameters and Event-Handler Methods Alice. Mouse clicks Interactive programs often allow the user to mouse click an object in the display. buttons in.
Parameters and Event-Handler Methods MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Functions Alice.
ActionScript: Addressing Display Objects, Duplicating MovieClips, Attaching MovieClips Dynamically MMP 220 Multimedia Programming This material was prepared.
ActionScript: Loading External Content with MovieClipLoader Class, Listener Objects, Preloaders, HitTest, Loading Sound MMP 220 Multimedia Programming.
Variables and Inheritance Part 1
Programming: Simple Control Structures Part 2 – Repetition Alice.
ActionScript: Functions, Parameters, Functions that return a value, Variables, setInterval Functions MMP 220 Multimedia Programming This material was prepared.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
CompSci 4 Chap 5 Sec 2 Oct 18, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
ActionScript: For Loops, While Loops, Concatenation and Arrays MMP 220 Multimedia Programming This material was prepared for students in MMP220 Multimedia.
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.
ActionScript: Classes, Properties, EventHandler Methods, Datatypes & Control Structures MMP 220 Multimedia Programming This material was prepared for students.
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Functions, Loops, and Parameters.
Programming: Simple Control Structures MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Variables & Conditions.
ForLoopsInAlice1 Stephen Cooper Wanda Dann Randy Pausch Barb Ericson Oct 2009 Counted (For) Loops in Alice.
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.
Wanda Dann Don Slater Classes and Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved.
Interactive Programming MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project.
Parameters Alice. A beetle band Our task is to create an animation for a bug band as an advertisement for their next concert.
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.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Wanda Dann Don Slater Methods Panel & Object Tree Copyright 2012 Wanda Dann, Don Slater All rights reserved.
Class-level Methods and Inheritance Alice. Class-level Methods Some actions are naturally associated with a specific class of objects. Examples A person.
Alice Final Project Web Design. Alice Final Project You have a choice of two scenarios: 1. A game of some sort. You must devise a score-keeping mechanism.
Lists and Iteration in Alice
Parameters Section 8-8 Web Design.
Arrays and Array Visualization
Parameters Alice.
Lists Alice.
Lists Alice.
Parameters and World-level methods
Animation Programs: Scenarios and Storyboards
Programming: Simple Control Structures
Lists Alice.
Functions Alice.
Lists Alice.
Classes and Objects Wanda Dann Don Slater
Parameters Alice.
Functions Alice.
Class-level Methods and Inheritance
Functions Alice.
Functions Alice.
Presentation transcript:

Parameters MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum redesign project funded by National Science Foundation grant # Co PI’s Christopher Stein and Jody Culkin BMCC CUNY The material in this handout is taken from “Learning to Program with Alice” a project supported by the National Science Foundation under Grant NSF , NSF , and NSF Contact Wanda Dann: Stephen Cooper: Randy Pausch: and Don Slater:

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 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. solo Parameters: bandMember, music Do together Do in order bandMember move up bandMember move down play music

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 Section2 – Parameters