Plotting Points. By Francine Wolfe Professor Susan Rodger Duke University June 2010

Similar documents
Repetition everywhere comparing while in a method and as an event. Comparison

Nonvisual Arrays and Recursion. by Chris Brown under Prof. Susan Rodger Duke University June 2012

Skater World: Part Three

Alice: A Free 3D Animation World for Teaching Programming

The Matrix. By Melissa Dalis Professor Susan Rodger Duke University June 2011

Learning to Program: Part 1 Scene Setup and Star4ng Anima4on

Animating Objects in Groups: Using Arrays and Lists

Animating Objects in Groups: Using Arrays and Lists. By Ruthie Tucker under the direction of Professor Susan Rodger Summer 2008

By Ruthie Tucker Under the direction of Professor Susan.

Making Billboards. By Deborah Nelson Duke University, Under the direc:on of Professor Susan Rodger, July 14, 2008

1 ball, 2 ball, red ball, blue ball. By Melissa Dalis Professor Susan Rodger Duke University June 2011

using Arrays and Lists in an Alice world Prerequisites Everything World.OpeningScene Cinderella.end the chickens while they dance.

Step 1: Changing the Penguins Colors. Download the starting world that goes with this tutorial. We are

3 D Helium Molecule Tutorial. Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008

The Essentials of Alice

By Deborah Nelson Duke University Under the edirection ecto of Professor Susan Rodger July 13, 2008

Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes

Headshots in Alice. Duke University Professor Susan H. Rodger Gaetjens Lezin July 2008 Updates made June 2014 by Yossra Hamid

Princess & Dragon Part 4: Breathing Fire Adding Effects to Alice

The Essentials of Alice (Bunny) By Jenna Hayes under the direction of Professor Susan Rodger Duke University July 2008

Princess & Dragon Part 1: Objects in an Alice World

Tips and Tricks for Microsoft PowerPoint Game

Skater World: Part Four. By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 2009

Shorter of two objects and changing color V2

Game Design Unity Workshop

Coloring Randomly: Random Selec2on in Alice. By Jenna Hayes under the direc2on of Professor Susan Rodger Duke University July 2008

How to Create a Simple Animation Using MAYA

Lists Tutorial. By Deborah Nelson. Professor Susan Rodger July 13, 2008

A TUTORIAL ON WORD. Katie Gregory

Mastering Truspace 7

A Simple Quiz for Alice 3.2: Ask User Functions.

ADD A 3-D PIE CHART TO THE WORKBOOK

HOUR 12. Adding a Chart

This Tutorial is for Word 2007 but 2003 instructions are included in [brackets] after of each step.

Alibre Design Tutorial - Simple Revolve Translucent Glass Lamp Globe

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

Simple Glass TNT Molecule Tutorial

Scene changes. camera. In the object tree, expand the Dummy Objects folder. Rename the dummy scene1. (by right

Tangents. In this tutorial we are going to take a look at how tangents can affect an animation.

STEP ACTIONS: STEP TOWARDS AND STEP AVOIDING

ICS 61 Game Systems and Design Introduction to Scratch

Creating Breakout - Part 2

SolidWorks 2½D Parts

SolidWorks Intro Part 1b

Setting up A Basic Scene in Unity

Alice. Creating Sounds, Making Billboards, Fun with 3 D Text, New Events, and Rotating Objects

Using Functions in Alice

SUM - This says to add together cells F28 through F35. Notice that it will show your result is

Your screen may look different from mine below but that is OK.

CompSci 94 Making Decisions February 8, Prof. Susan Rodger

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Advanced Techniques. Criterion E: Product development. Three or more related tables. Complex queries / Calculated fields. Use of graphics fields

2.1 Transforming Linear Functions

INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES

Content provided in partnership with Que, from the book Show Me Microsoft Office Access 2003 by Steve JohnsonÃÃ

Brianna Nelson Updated 6/30/15 HOW TO: Docs, Sheets, Slides, Calendar, & Drive. English

Making Objects Move in Unison: Using Lists. Overview

Making Objects Move in Unison: Using Lists

How to Make Graphs with Excel 2007

PediGait IP. Users Manual

Lines and Circles Guided Practice: Teacher Instructions

Creating the Tilt Game with Blender 2.49b

Introduction to Flash - Creating a Motion Tween

Submerge Camera Shader

Maya Lesson 6 Screwdriver Notes & Assessment

CS Multimedia and Communications REMEMBER TO BRING YOUR MEMORY STICK TO EVERY LAB! Lab 02: Introduction to Photoshop Part 1

Textures and UV Mapping in Blender

1.a) Go to it should be accessible in all browsers

Creating joints for the NovodeX MAX exporter

Using Dreamweaver CC. Logo. 4 Creating a Template. Page Heading. Page content in this area. About Us Gallery Ordering Contact Us Links

SciGraphica. Tutorial Manual - Tutorials 1and 2 Version 0.8.0

A Guide to Autodesk Maya 2015

COMP : Practical 6 Buttons and First Script Instructions

Get comfortable using computers

Pre-Lab Excel Problem

Repetition. Add in Objects. Position Objects. Monkey Eat Bananas Repetition Simple Loops and Conditional Loops for Alice 3

Monkey Eat Bananas Repetition Simple Loops and Conditional Loops for Alice 3

This Tutorial is for Word 2007 but 2003 instructions are included in [brackets] after of each step.

In this section you will learn some simple data entry, editing, formatting techniques and some simple formulae. Contents

Week 5 Creating a Calendar. About Tables. Making a Calendar From a Table Template. Week 5 Word 2010

DataSweet also has a whole host of improvements which are not covered in this document.

Chapter 0. Getting Started. Objectives

Part II: Creating Visio Drawings

3.6: First Person Computer Games

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2010

Making a maze with Scratch

Creating a Fancier Fox and Inheritance in Alice 3

Pong in Unity a basic Intro

NAME EET 2259 Lab 3 The Boolean Data Type

GIMP ANIMATION EFFECTS

Using Flash Animation Basics

How to Create Custom Name Badge Inserts with a Mail Merge in Microsoft Word 2007

Microsoft Excel 2007

Let s use Technology Use Data from Cycle 14 of the General Social Survey with Fathom for a data analysis project

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

Instructions on Adding Zeros to the Comtrade Data

Blender Lesson Ceramic Bowl

Interactive Tourist Map

Workshop BOND UNIVERSITY Bachelor of Interactive Multimedia and Design Beginner Game Dev Character Control Building a character animation controller.

Creating a Website Using Weebly.com (June 26, 2017 Update)

Transcription:

Plotting Points By Francine Wolfe Professor Susan Rodger Duke University June 2010

Description This tutorial will show you how to create a game where the player has to plot points on a graph. The method we will use to check where the points are can be used in many different types of Alice worlds.

Set up Create new Alice world using any template except water You should have downloaded the grid.gif file that went with this tutorial. If you haven t, do that now In Alice, click file, make billboard Browse to find the file grid.gif and click import

Add a sphere Click In local gallery go to shapes folder Add a spherehighpoly. Rename it point. There is also a regular sphere object you could also use. The spherehighpoly object has smoother edges In the properties tab, change the sphere s color to blue. Make it smaller. See the first slide for an approximate size We want the user to be able to click and drag the point to a spot on the grid.

Let the mouse move the sphere In the events panel click create new event. Select let the mouse move <objects> Click any object and select create new list. Call it points and select object for the type. Click new item and change none to point. Then click ok. You will notice when you click play that there is a problem. When you click and drag the point, it moves forward and back instead of up and down. We can fix this problem by putting the grid flat on the ground

Positioning the Grid Right Click on the grid and select turn to face camera Right click on camera, select move to, grid. Right click camera, move up, 10 m Right click camera turn forward ¼ revolution. You won t be able to see the grid yet because it is thin like a sheet of paper. Right click on the grid in the object tree, select turn backward ¼ revolution. It should be flat on the ground now.

Positioning the Grid Increase the size of grid and position it like in the bottom picture. It should take up most of the screen but still have a little room on the side where the teacher can stand To bring the point to the current view, right click on point in the object tree. Select move to and grid. Now move it off to the side of the grid.

Add a Teacher We will have a teacher tell the player what point to plot Go to the people folder in the local gallery and add one of the people. I chose a madscientist Right click on your new person in the object tree and select rename. Type teacher Position the teacher to the right of the grid like in the picture

Using axes Now it would be nice if there was some way to check the position of the point when it is on the grid If we had an object on each of the axes we could check the points position in relation to those Luckily, Alice has an Axes object. Go the shapes folder and add axes. Move them so the green arrow (which looks like a dot right now) is right at the origin Turn it so the blue arrow points up in the direction of the y axis and the red arrow points right in the direction of the x axis.

Positioning Tilt the axes back until the green arrow is flat and pointing up like in the picture Go to the quad view to position it better It is very important that the axes are aligned with the axes on the grid. This will help with plotting points later While you are in the quad view double check that the point is at the same level as the grid (not above or below it) This will be easiest to see in the from the right and from the front views

Ok button Go back to single view and in the local gallery click create 3D text and type OK Rename the 3D text OK and position it to the left of the grid like in the picture Change the Color to Blue

Setting up Methods Click done Under the world methods tab click create new method. Call it checkpt Click create new event and select when the mouse is clicked on something. Change anything to OK and nothing to checkpt

Variables Click create new variabl in the new checkpt method, name it x and select number for the type Create another number variable named y These will be the coordinates of the point Drag the variable x into the do nothing. Select set value and 1 for now. Do the same thing for y

Calculating the Distance Click on point in the object tree and under the functions tab find distance to the right of. Click and drag that into the x set value. Select axes, up, the entire up. Now find distance above and drag it into y set value Select axes, right, the entire right.

Converting Units A units length in Alice is probably not the same as one unit on the grid. So we need to check how those units relate to each other. At the bottom of the screen, find print. Drag it below the other two lines Select object, expressions, x Do the same thing for y This will display the values for x and y at the bottom of the screen The print method can be very helpful when testing code and checking the values of variables

Click play Play Drag the point onto the grid and click ok. The coordinates should be displayed at the bottom of the screen. They are probably incorrect right now but we will change that. Move the point and click ok again. The coordinates should be different now. Position the ball right at the origin and click ok.

Adjusting X Make note of what x is (rounded to the second digit) at the origin. For me it says.05. This number is how much we need to adjust the checkpt method for x. Click the white arrow between the two mores in the x set value line. Select math, and select. Click other and type the number. Make sure if your number was negative, you type a negative number.

Adjusting X Now play your world again and see what x it gives you the origin. It should be about 0. It doesn t need to be exact, especially since you probably didn t put the point exactly in the center anyways. The first two digits after the decimal should be 0. Try moving the point around and putting it back at the center a few times. It should give you negative number very close to zero sometimes and sometimes a positive one. Now we have the origin set up correctly for x. Try moving the point to the right. When you click ok, the x value will probably be too small. This is because of the difference in unit sizes. We will have to multiply the distance by a number to take that into account.

Check what number it gives you at a certain point. Use that number to decide what to multiply by. For example, when I put it at the 6, it gives me an x value of about 1. If I want to this to be a 6 I need to multiply by 6 Click the arrow before the last more. Select math, *, other. Type the number you want to try

Adjusting X Now test it again. It is best to try it far away from the origin because you will be able to see the error easiest there. You might need to change your multiplying number slightly to make it more accurate. Try some different numbers until you find one that works. It should give you between 5.9 and 6.1 when it is at 6. I changed my number to 5.4. Try moving it to some different points and make sure it still works for those x values.

Now do the same thing for y Adjusting Y Check the number it gives you at the origin. Subtract that number. First two digits should be zero at the origin Check what it gives you at other spots. Find a number to multiply by. Now both x and y should be working In the properties tab of axes set visible to false. This will make that axes invisible.

Adding Instructions Now let s change it so the teacher says what point you should graph Click on the world.my first method tab. Drag in the teacher say method. Type plot a point by dragging the blue ball to the correct coordinates. Make a copy of that line and change the text to first plot (2,5) then click ok Now we want to create two world variables to store this coordinate, one for the x and one for the y

Create world variables for the coordinates Under the world properties tab click create new variable. Call it xgoal and select number Create another number variable and call it ygoal. Drag both of these new variables into my first method and set xgoal to 2 and ygoal to 5

Checking the Values Click the world.checkpt tab in the method editor We want this method to compare x and y (where the blue point is) to xgoal and ygoal. However we can t just check to see if they are equal. For example, if the point is at (1.9,5.2) that is close enough that we should count it as good. Let s have it allow you to be up to.5 units off. So we want to check to see if the difference between the goal coordinate and the actual coordinate is less than.5

Checking the Values: part 2 Drag in an if/else and select true Go to the world functions tab and drag in a<b into the true. Select 1 and.5. Now find absolute value of in the properties and drag it to the 1 Now go to the world properties tab and drag in xgoal to the 1. Click the arrow next to it and select math xgoal, expressions, x Drag the if block to the clipboard and put the copy in the first do nothing Drag in y where it says x and ygoal where it says xgoal.

Congratulating the Player If both the x and y are close enough we want the teacher to congratulate the player. Drag in teacher say to the first do nothing. Click other and type Good Job Make two copies of that line and move them to each of the elses. Change the text for both to Try again Since we are done testing the program you can delete the print x and print y lines so the values won t be displayed at the bottom of the screen. See the next slide for a screen shot

picture

Adding more points Lets modify our program now so the teacher tells the player multiple points to plot We will need to change xgoal and ygoal when there is a new point to plot Go back to the my first method tab. Go the world properties tab. Drag in xgoal, select set value. Type 3 and click ok. Now do the same thing with ygoal but type 1. Go to the teacher methods and drag in say. Type Plot (3,1) If you click play you will notice that the teacher gives the second set of instructions before you have plotted the first point.

Type done for the name. Waiting We need to put something in between the two sets of instructions to make him wait. We need some way for Alice to keep track of whether the player is ready to plot the next point. Let s create a variable for that. Go to the world properties tab and click create new variable We want this variable to have two possible values. Because the player can either be done or not done. A boolean variable would work well for this because it has two possible values : true and false. Click boolean and set the value to false.

Setting the variable Done should be false at the beginning. Then once the point has been plotted we want to change it to true. Go to the checkpt tab. When the point is in the correct spot, we want to set done to true. Drag done right below the teacher say Good Job! line. Select set value, true.

Using the variable to wait Go back to my first method Now while the player is NOT done we want to wait Drag in a while before the second xgoal set value. Select expressions, world.done. Now click world.done and select logic, not done Now while done is false, it will continue to do nothing. Once done changes to true, it will come out of the while loop and set the new coordinates

Adding more points You can play your world now and see that it works for two points. If you want to add more, you only need to change the code in my first method. For each point you will need four parts shown in the picture below

Finished Congratulations! You are done with this tutorial. The next slide has an extra exercise you can do. This technique can be used for different worlds in which the player has to graph points. On our website you can find a sample world using this technique for a world where the player learns how to plot a line

Extra Exercise Modify your world so that a random coordinate is generated each time. You will need to set xgoal and ygoal to two random numbers. You can find random number in the world function tab.