How Tall Are You? Introducing Func6ons

Similar documents
How Tall Are You? Introducing Functions

Tutorial on Bunny visi/ng his animal friends - parameters, events for Alice 3

Alice and Daisies: Posi/oning and Moving Objects in Alice. By Jenna Hayes under the direc/on of Professor Susan Rodger Duke University July 2008

The Essen(als of Alice (Bunny) By Jenna Hayes under the direc(on of Professor Susan Rodger Duke University July 2008

Princess & Dragon Version 2

Learning to Program: Part 2 Wri0ng Methods and Events

Objects in Alice: Positioning and. Moving Them July 2008

Princess & Dragon Part 2: Teaching a Dragon to Fly Methods & Proper:es

Alice Learning to program: Part Two by Ruthie Tucker and Jenna Hayes Under the direction of Professor Susan Rodger Duke University, July 2008

The Basics. By Jenna Hayes under the direction of Professor Susan Rodger Duke University July

Begin at the beginning," the King said, very gravely, "and go on till you come to the end

Demo. Getting Started with Alice Demo

Let's Race! Typing on the Home Row

Part II Coding the Animation

Once you have chosen the water world this is how your screen should look.

Alice. our characters it would be nice to be able to. This can simplify the story and sometimes add. Zoom in on our first character when she talks

An Introduction to Alice

Princess & Dragon Part 3: A Knight Comes Riding In Cameras & Events

Creating a Historical Tour in Alice

Challenge 1: Tami s World

Alice: A Visual Introduction to Programming. Chapter 1 Part 2

Ready, SET, go! By Melissa Dalis Professor Susan Rodger Duke University July 2011

Managing images with NewZapp

By Maggie Bashford Professor Susan Rodger Duke University July

Try what you learned (and some new things too)

CONCEPTS EXPLAINED CONCEPTS (IN ORDER)

Alright! I can feel my limbs again! Magic star web! The Dark Wizard? Who are you again? Nice work! You ve broken the Dark Wizard s spell!

Turtles and Geometry

To solve a problem (perform a task) in a virtual world, we must accomplish the following:

Motion Blur with Mental Ray

CS Problem Solving and Structured Programming Lab 1 - Introduction to Programming in Alice designed by Barb Lerner Due: February 9/10

Mr. Giansante. Alice. 3D Programming

Converting a solid to a sheet metal part tutorial

How to create a cove for cove lighting in DIALux In this tutorial you will learn how to make a cove similar to the one in the following image

GAME:IT Junior Bouncing Ball

Resources to help clients optimize their move online

3. Ready-to-Make Projects

Quilt Pro 6 Lesson Quilt in a Quilt

Resizing and Resampling Images Tutorial. Please choose any image and open it in Photoshop.

prepared by Allison Hwang for T. Purdy 2011

In this project you ll learn how to code your own musical instruments!

Overview. The Game Idea

Star Defender. Section 1

2809 CAD TRAINING: Part 1 Sketching and Making 3D Parts. Contents

An Introduction to ScratchJr

This Photoshop Tutorial 2012 Steve Patterson, Photoshop Essentials.com. Not To Be Reproduced Or Redistributed Without Permission.

COMPUTING CURRICULUM TOOLKIT

Mr. Giansante. Alice. 3D Programming

How to prepare your files for competition using

Part II: Number Guessing Game Part 2. Lab Guessing Game version 2.0

2

Veco User Guides. Property Photos & Images

Basic Tutorials Series: Import A Photograph. RenoWorks Support Team Document #HWPRO0003

Photoshop Elements Hints by Steve Miller

Inserting Images Into Documents

EG1003 Help and How To s: Revit Tutorial

GAME:IT Junior Bouncing Ball

Year 1 Spring Term Week 8 to 9 Measurement: Length & Height

Step 1: Create A New Photoshop Document

Blend Photos Like a Hollywood Movie Poster

1 Best Practices Course Week 12 Part 2 copyright 2012 by Eric Bobrow. BEST PRACTICES COURSE WEEK 12 PART 2 Program Planning Areas and Lists of Spaces

PowerPoint 2016: Formatting Pictures. Introduction

Scratch for Beginners Workbook

Overview. Scene Changes. Camera Markers in Alice 3. Open a new Alice world

Adobe Photoshop Chapter 3 Study Questions /50 Total Points

How to Convert & Resize Images in Bulk

Release Notes - Fixes in Tekla Structures 2016i SP1

The Basic RAW Image Processing Workflow In PSE 2018

Creo Revolve Tutorial

Game Design Curriculum Multimedia Fusion 2. Created by Rahul Khurana. Copyright, VisionTech Camps & Classes

ChatBot. Introduction. Scratch. You are going to learn how to program your own talking robot! Activity Checklist. Test your Project.

GIS Module GMS 7.0 TUTORIALS. 1 Introduction. 1.1 Contents

Entering Entrant and Image Title Information into the EXIF Data

Blend Photos With Apply Image In Photoshop

The crate placeable - Exporting and testing in Game

Annex IV - Stencyl Tutorial

Navigating the Civil 3D User Interface COPYRIGHTED MATERIAL. Chapter 1

Lesson 2 Game Basics

v. 8.0 GMS 8.0 Tutorial GIS Module Shapefile import, display, and conversion Prerequisite Tutorials None Time minutes

Advanced Excel. Table of Contents. Lesson 3 Solver

background research word count Title SUBMISSION GUIDELINES FOR PUBLISHING SCIENCE FAIR WRITTEN WORK

SCRAPENDIPITY Designs. Electric Quilt 7 Tutorial. Building a Quilt

Meteor Game for Multimedia Fusion 1.5

Auntie Spark s Guide to creating a Data Collection VI

Volume of Revolution Investigation

BEST PRACTICES COURSE WEEK 21 Creating and Customizing Library Parts PART 7 - Custom Doors and Windows

More Actions: A Galaxy of Possibilities

You might be asking some of these ques3ons are it relates to digital photography and controlling quality star3ng with your camera.

Constructing a Wedge Die

Basic image edits with GIMP: Getting photos ready for competition requirements Dirk Pons, New Zealand

Moving Man Introduction Motion in 1 Direction

Kismet Interface Overview

ADD A REALISTIC WATER REFLECTION

Creating Family Trees in The GIMP Photo Editor

Leica 3D Disto Application Veranda / Conservatory

Ansoft Designer Tutorial ECE 584 October, 2004

How to Blog to the Vanguard Website

Unit 6.5 Text Adventures

AutoCAD Line Types If AutoCAD linetypes are disabled during configuration, Slick! will only plot/print straight lines!

Vectorworks Essentials

Transcription:

How Tall Are You? Introducing Func6ons By Jenna Hayes under the direc6on of Professor Susan Rodger Duke University July 2008 Updates made June 2014 by Yossra Hamid

Step 1: Getting Started In this tutorial you will be learning to use func4ons to ask how tall a character is. Using this informa4on two characters will compare their height and give a specific response depending on who is the tallest. A func6on in Alice is basically a ques6on about informa6on in your Alice world that Alice answers. You can ask how tall or wide an object is, how far away it is from another object, and many other ques6ons.

Step 1: Getting Started Click on the green Add Objects buson. Go into your Local Gallery and find the People folder. Then, add the RandomGuy2 object to your world. Now go back up to the Local Gallery, and find the Animals folder. Add a penguin to your world. Update: RandomGuy2 is no longer an object in newer versions of Alice. Use any other object in the People folder (for example, Josh ).

Step 1: Getting Started Using your object moving busons, move the person to the lex of your viewing screen, and move the penguin to the right of your viewing screen. Your screen should look like this when you are finished.

Step 1: Getting Started Right click on penguin in the object tree, and go to methods. Then select penguin resize, and then other. On the calculator that pops up, type 1.75. Your penguin will get larger.

Step 1: Getting Started Now, right click on randomguy2 in the object tree, and select methods. Then find his turn to face method. Click on that, and then select penguin, and the en6re penguin. Then, right click on penguin in the object tree, and select methods. Go to penguin turn to face, and then select randomguy2, and the en6re randomguy2. Your characters should now be facing each other.

Step 2: Understanding Functions Click on the penguin object in the object tree. Then click on the func6ons tab. You will see a LONG list of func6ons. Scroll down and look at the func6ons under size. Each of these func6ons asks a ques6on about the penguin, and then keeps the answer so that you can use it in your Alice world. How wide is the penguin? Is the penguin larger than a certain object? Is the penguin taller than a certain object? These func6ons can be very useful in Alice. What if, for example, you want to make something move up and stand on top of the penguin s head? You don t know how exactly how tall the penguin is. But Alice does!

Step 3: Using the True or False Functions Some func6ons in Alice are statements to which the answer is either true or false, like the one on the previous page that says, penguin is taller than. We want to know whether the penguin is taller than the randomguy2. It s almost impossible to tell just by looking at them, because their heights are so close together. So we will use a func6on to know for sure. We are going to add commands so that when the Alice world starts, if the penguin is taller, it will say Hah! I m taller!, and do a victory spin, but if the randomguy2 is taller, he will say, Hah! I m taller!, and do a victory spin.

Step 3: True or False Continued... Since we only want the penguin to say Hah! I m taller if he is taller, we need to use something called an If Else statement. You will find it located below your method editor: First drag a Do in order into your method editor. Then, inside that, drag in an If Else statement. Select true when you drop it. We will replace this later.

Step 3: True or False Continued... Here is where you put the ques6on that is either true or false. For us, that will be penguin is taller than randomguy2. Since it is currently set at true, that means this If Else says, If this statement right here is true, do whatever commands are right under it. This is where you put whatever you want to happen if the answer to your ques6on is true. This is where we ll tell the penguin to say Hah! I m taller! This is where you put whatever you want to happen if the answer to your ques6on is NOT true. If it is not true, it will skip everything above the Else, and go straight to whatever is here. This is where we ll tell the person to say Hah! I m taller!, because if our statement is false, and the penguin is NOT taller, that means the person is taller!

So let s construct our ques6on. Step 3: True or False Continued... Click on penguin in the object tree and then click on func6ons. Find the penguin is taller than func6on, and drag it over the word true in your If Else statement. When the lisle menu pops up, click on randomguy2.

Step 3: True or False Continued... Get a Do together from the bosom of your method editor and drag and drop it into the If/ Else right below If. Then, click on penguin in the object tree, and go to his methods list. Drag and drop penguin turn into the Do together. When you drop it, select right, and then 1 revolu6on. Your code will look like this.

Step 3: True or False Continued... Then, find penguin say, and drag it into the Do together. When the menu pops up, click on other, and type in Hah! I m taller!.

Step 3: True or False Continued... Drag and drop another Do together into the If/Else, this 6me right under the Else. Click on randomguy2 in the object tree and look at his methods list. Find randomguy2 turn, and then drag and drop that into the newest Do together. When you drop it, select right, and then 1 revolu6on. Your code will look like this.

Step 3: True or False Continued... Next, find randomguy2 say and put it in the Do together. Tell him to say Hah! I m taller! Now play your world and see who is taller!

Step 3: True or False Continued... It seems that the penguin is taller. To test and make sure your func6on is working correctly, go to the Add Objects screen and use your object busons to resize the randomguy2 and make him clearly taller than the penguin. Now, play your world again. This 6me, the guy will say that he is taller! You can change him back to his normal size axer you test this out.

Step 4: Using Number Functions Now we re going to use one of the func6ons that is a ques6on whose answer is a number. We re going to make the penguin move right up to the man and give him a hug. The only problem is, we don t know how far to tell him to move! That s why we ll use a func6on! First we ll tell the man to say something. He s 6red of compe6ng with the penguin about their height, and he wants to be friends. Click on randomguy2 in the object tree, then click on methods. Find randomguy2 say, and drag it under your If Else statement. Make him say Let s be friends. Give me a hug, penguin!

Step 4: Number Functions Continued... Now we want the penguin to move right up to the guy to hug him. Click on penguin in your object tree and then click on methods. Find the penguin move and drag it into your method editor under everything else. We don t know exactly how far yet, so just put 1 meter for now. Play your world just to see what it looks like.

Step 4: Number Functions Continued... Now we re going to use a func6on to tell the penguin how far forward to move. Click on penguin in your object tree, and then click on the func6ons tab. Find the func6on called distance to. Drag that func6on over the 1 meter on your penguin move forward command and drop it there. On the menu that pops up, select randomguy2.

Step 4: Number Functions Continued... Try playing your world. What happens? The penguin moves too far, into the body of the randomguy2. It would be nice if the penguin would stop about 0.5 meters in front of randomguy2. We can select math, followed by -, followed by a number. Click here to apply math. Your code for this line will then look like this:

Step 5: Finishing Up The last thing you need to do is make the penguin hug the guy. Click on penguin in the object tree, and then click on the methods tab. Click on create new method, and call it hug. In this method, experiment un6l you find code that makes the penguin hug the guy. My code for penguin.hug looks like this.

Step 5: Finishing Up Now click on the world.my first method tab of your method editor. Make sure you have clicked on penguin in the object tree, and then look at the penguin s methods list. Find penguin.hug, and drag it into the bosom of your method editor. Your final code will look like this.

Step 5: Finishing Up Continued... Play your world, and see the plot unfold! Now you know the basics of using func6ons. We only used two func6ons in this tutorial, but there are MANY func6ons in the Alice world that can be useful. Try some more func6ons on your own and explore how they work!