Tutorial on Kangaroo visiting his animal friends - parameters, events Susan Rodger Duke University June 2009.

Slides:



Advertisements
Similar presentations
Getting Started With Alice: The Basics By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
Advertisements

Visual Lists By Chris Brown under Prof. Susan Rodger Duke University July 2012.
Repetition everywhere – comparing while in a method and as an event Susan Rodger Duke University July 2010 modified July 2011.
Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
How Tall Are You? Introducing Functions By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made June 2014 by.
Using Functions in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University July 2008.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Using Functions in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University July 2008.
Lights Camera Action! Part 3: BDE Events By Deborah Nelson under the direction of Professor Susan Rodger Duke University July 2008.
Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Rodger Duke University, July 2008.
Wizard Game: Class-Level Variables in Alice By Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July
Creating a 3D Interactive Story Prof. Susan Rodger Duke University Feb. 24, 2007.
Alice Learning to program: Part 1 Scene Setup and Starting Animation by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke.
Calvin and Hobbes Teach Properties and Functions Created by Daniel MacDonald under the direction of Professor Susan Rodger Duke University June 2013.
Methods Tutorial: Part One By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 9, 2008.
Alice Learning to program: Part Two by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008.
Shorter of two objects and changing color Functions, events and setting the color Susan Rodger, Duke University June 2008.
Checking for Collisions Ellen Yuan Under the direction of Professor Susan Rodger at Duke University June 2014.
Line up By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Working with Numbers in Alice - Converting to integers and to strings - Rounding numbers. - Truncating Numbers Samantha Huerta under the direction of Professor.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
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
Shorter of two objects and changing color V2 Functions, events and setting the color in sequence and randomly This is a modification of the Changing Color.
Checking for Collisions: Alternative Method Erin Taylor Under the Direction of Susan Rodger July 2015 Duke University.
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.
Methods Tutorial: Part Two By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
Now that the kangaroo and the turtle have raced, let's make a method for the kangaroo to hop back to the turtle and challenge him to a race again. Click.
Tutorial on Kangaroo visiting his animal friends - parameters, events.
Scene changes By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June
Making a Timer in Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
Piñata Game: Keeping Score in Alice By Maggie Bashford Professor Susan Rodger Duke University July
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1,
Mathematical Expressions, Conditional Statements, Control Structures
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,
Bunny Eat Broccoli Repetition – Simple loops and Conditional loops Susan Rodger Duke University July 2011.
The Essentials of Alice (Bunny) By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008.
Balancing the scales: Inequalities By Melissa Dalis Professor Susan Rodger Duke University June 2011.
Simple Collision Detection By David Yan Under the direction of Professor Susan Rodger and Chari Distler Duke University, June 2015.
Ready, SET, go! By Melissa Dalis Professor Susan Rodger Duke University July 2011.
Creating a 3D Interactive Story Prof. Susan Rodger Duke University July 19, 2007.
Learning to Program: Part 1 Scene Setup and Starting Animation by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University,
Skater World: Part Three By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 2009.
An Introduction to Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University, June 2009 Updated June 2014 by Ellen Yuan.
BDE tutorial By Deborah Nelson Duke University Under the direction of Professor Susan Rodger July 13, 2008.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
Repetition everywhere – comparing while in a method and as an event Susan Rodger Duke University July 2010.
Illuminating Computer Science CCIT 4-6Sep
Creating a Fancier Chicken to use in several worlds - Inheritance Susan Rodger Duke University June 2009.
Using Placeholders to Simplify your Methods: Learning Methods, Part 2 By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
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.
How Tall Are You? Introducing Functions for Alice 3 By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008 Updates made.
The Essentials of Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University May 2009.
Tutorial on Bunny visiting his animal friends - parameters, events for Alice 3 Susan Rodger Duke University June 2009 Updated by Yossra Hamid on October.
Jonathon Kuo Under the Direction of Dr. Susan Rodger
A Simple Quiz for Alice 3.2:
Comparing objects and changing color
Bunny Eat Broccoli Repetition – Simple loops and Conditional loops
Tutorial on Kangaroo visiting his animal friends - parameters, events
A Simple Quiz for Alice 3.2:
Methods Tutorial: Part Two
Making Objects Move in Unison: Using Lists
Checking for Collisions: Using Functions in Alice
Using Functions in Alice
Princess & Dragon Part 3: A Knight Comes Riding In—Cameras & Events
How Tall Are You? Introducing Functions
Using Placeholders to Simplify your Methods: Learning Methods, Part 2
Making Objects Move in Unison: Using Lists
Presentation transcript:

Tutorial on Kangaroo visiting his animal friends - parameters, events Susan Rodger Duke University June 2009

Start with a new world Add a Kangaroo, a cow, and several animals of different heights, spread around the world I picked bunny, cow, horse, ladybug, tortoise, turtle – any animals will do but make sure you have some tall animals.

Problem The kangaroo wants to visit each animal where “visit” means: the kangaroo and the animal face each other, the kangaroo moves close in front of it, the kangaroo says “hi” and then the Kangaroo jumps over it. However, the kangaroo can only jump 1 meter high.

Parts of the Tutorial Part 1: Kangaroo visit each friend Part 2: Kangaroo either go around or jump over Part 3: Create an event to click on animal to visit

Part 1: Kangaroo visit Cow Create a “Kangaroo” method called visit for the Kangaroo to visit the cow

See the new Kangaroo visit method tab appear

Enter the following code The kangaroo turns to visit the cow and moves toward it. To test it out, change the event “when the world starts” to “kangaroo.visit” and PLAY

How to move the Kangaroo all the way to the cow Click on Kangaroo, and under Kangaroo’s details, click on Functions. Click and drag “kangaroo distance to” on top of the 1 meter.

Resulting in…. Click Play Yikes, The Kangaroo goes into the Cow! We want the Kangaroo to stop 2 meters in front of the cow (make sure the cow is more than 2m away).

Use Math and subtract 2 Click on white arrow Select “math”, then “minus sign” then “2”

Resulting in the following code The kangaroo will stop two meters in front of the center of the cow…

Next add a greeting and jump over Have the kangaroo say a greeting Then have the Kangaroo jump over the cow – The kangaroo must jump up – The kangaroo must jump 2m to the cow, plus the cow’s depth, plus another 2m past the cow Total distance: 4 + cow’s depth Find cow’s depth in the cow functions… – The kangaroo jumps down (code on the next page)

Add the remaining code Change “when the world starts” to Kangaroo.visit and “Play”

How to visit any friend – Add a parameter named friendToVisit - type should be Object – click ok

Now click and drag friendToVisit on top of the four occurences of Cow Click and drag from here

Change “when the world starts” back to myFirstMethod Click on myFirstMethod tab, Drag in visit for each friend and “Play”

Add another parameter of type String so Kangaroo can give a different greeting to each animal Click on the tab for Kangaroo.visit first Click on “create new parameter” The type is “Other” then “String” since the Kangaroo will say worlds Then click ok

The result is… Notice “greeting” is of type “ABC” or words Now click and drag “greeting” over the phrase the Kangaroo says “How are you doing?” Result is:

Back to MyFirstMethod, add greetings Replace “greeting=default string” to a different greeting for each animal. Then Click Play

Part 2: Going around or over friend Kangaroo can only jump 1 meter high If friend is shorter than 1 meter, it is ok to jump over If friend is 1 meter or taller, then go around them

First drag in an If/Else from the bottom of the window, placing after the “say”

Select “world”, “functions” and scroll to find math functions, then click and drag “a<b” selecting 1’s

Drag in “cow’s height” from the cow functions, then drop “friendToVisit” over cow

Move the kangaroo jump over code and put after the if. Then add code after the else to “go around”. Then Play

Part 3 – create an event to visit friend clicked on First, disable the event “when the world starts” so the movie will not play You can get the movie back, by enabling the event.

Create a new event When the mouse is clicked on something

Drag over the visit code into the do nothing and select “expressions”, “object under mouse cursor”, then a greeting

Here is the event. Now click “play” and click on different animals, but not the kangaroo… The Kangaroo will go visit the animal you click on. Click on another animal and it will go visit that animal.