Animating Objects in Groups: Using Arrays and Lists

Similar documents
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.

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

The Essentials of Alice

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

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

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

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

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

Making Objects Move in Unison: Using Lists. Overview

Making Objects Move in Unison: Using Lists

Learning to Program: Part 1 Scene Setup and Star4ng Anima4on

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

Methods Tutorial: Part Two. By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008

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

Using Functions in Alice

A TUTORIAL ON WORD. Katie Gregory

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

CompSci 94 Making Decisions February 8, Prof. Susan Rodger

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

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

Skater World: Part Three

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

How to Create a Simple Animation Using MAYA

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

Creating a Fancier Fox and Inheritance in Alice 3

A Dreamweaver Tutorial. Contents Page

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

Microsoft Office 365 OneNote and Notebooks

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

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

Site Manager. To edit a page already in place, click on the name of the page.

Outlook Web Access. In the next step, enter your address and password to gain access to your Outlook Web Access account.

Valuable points from Lesson 6 Adobe Flash CS5 Professional Classroom in a Book

Edge Television Advertisement. -Open the 3 images of TV characters and the network logo in Photoshop. Your images must be high resolution images!

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

Switchboard. Creating and Running a Navigation Form

Tips and Tricks for Microsoft PowerPoint Game

A Frontpage Tutorial. Contents Page

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

LESSON 8 COPYING SELECTIONS

A Simple Quiz for Alice 3.2: Ask User Functions.

Learn more about Pages, Keynote & Numbers

Creating a Histogram Creating a Histogram

POWERPOINT BASICS: MICROSOFT OFFICE 2010

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

Instructions for Using the Databases

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

FACULTY AND STAFF COMPUTER FOOTHILL-DE ANZA. Office Graphics

Class-level Methods. Chapter 6 part 1

PowerPoint 2010 Introduction

PowerPoint 2010: Basic Skills

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

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

Contents. How to use Magic Ink... p Creating Magic Revealers (with Magic Ink)... p Basic Containers... p. 7-11

Microsoft Office Outlook 2007: Intermediate Course 01 Customizing Outlook

SharpSchool Website Training Guide

Submerge Camera Shader

Getting Started (New Accounts)

Canon Image Browser EX: A Novice Tutorial for Creating a Vacation Slideshow. Eric Morlang

HAPPY HOLIDAYS PHOTO BORDER

Instructions for Formatting MLA Style Papers in Microsoft Word 2010

Mount Points Mount Points is a super simple tool for connecting objects together and managing those relationships.

FrontPage. Directions & Reference

STORYTELLING-PowerPoint-Windows Movie Maker 2

Piktochart 101 Create your first infographic in 15 minutes

HOW TO USE THE CONTENT MANAGEMENT SYSTEM (CMS) TABLE OF CONTENTS

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via by Friday, Mar. 18, 2016

NVU Web Authoring System

Flash Album Generator 2 Manual Version 1.0. About Flash Album Generator 2. Flash Album Generator 2 Manual version 1.0 DMXzone.com

Shorter of two objects and changing color V2

Classroom Blogging. Training wiki:

Fish Eye Menu DMXzone.com Fish Eye Menu Manual

Boise State University. Getting To Know FrontPage 2000: A Tutorial

Popcorn's ini Tutorial

COMP : Practical 6 Buttons and First Script Instructions

The PCC CIS etutorial to PowerPoint

Microsoft PowerPoint 2016 Part 2: Notes, Links, & Graphics. Choosing a Design. Format Background

Organizing Screens with Mission Control

SMART Recorder. Record. Pause. Stop

Introduction to Microsoft Office 2016: Word

DRAFT. Table of Contents About this manual... ix About CuteSITE Builder... ix. Getting Started... 1

HOW TO. In this section, you will find. miscellaneous handouts that explain. HOW TO do various things.

How to set up a Default Printer

Using Mail Merge in Microsoft Word 2003

Magazine Layout Design. and Adobe InDesign basics

Introduction. Getting Started. Selecting a Template. 1 of 1

Fireworks 3 Animation and Rollovers

Final Cut Pro: Intro How to Make a DVD from a mini-dv tape

Introduction. Table Basics. Access 2010 Working with Tables. Video: Working with Tables in Access To Open an Existing Table: Page 1

Chat Activity. Moodle: Collaborative Activities & Blocks. Creating Chats

Interactive Tourist Map

How to Properly Format Word for MLA Format and keep it that way!

OU EDUCATE TRAINING MANUAL

Templates and Forms A Complete Overview for Connect Users

Google Docs. Tutorial by M. Lambert 2018 (Q1.L6 Maternity Leave) Q1.L2

Appleworks 6.0 Word Processing

Creating a Brochure in Publisher

Shorter of two objects and changing color

Transcription:

Animating Objects in Groups: Using and By Ruthie Tucker under the direction of Professor Susan Rodger Summer 2008 Description This tutorial will cover the basics of using arrays and lists in an Alice world. and lists are very useful ways to put objects into groups. It uses a set of chickens on a farm to illustrate these concepts. Starting Out To start, download the starting world for this tutorial, and save it in a directory that you can find again. Open up Alice, and then open the world. You will see several objects already in the world for you. What is a List? Starting Out A list is, you guessed it, a list of objects that you can have perform the same actions simultaneously, or one by one. What is an Array? An Array is very similar to a list, except in an array, each item has a numbered spot in the array. In Alice, and are also visual objects which can be dropped into your world. 1

Making a List We are going to create a list, and use it to make our chickens move in unison. Go to the world s properties tab and click the create new variable button. Name the variable ChickensDanceTogether, and select Object as the type. Then, click the box next to the words make a List. A white area will appear at the bottom of the gray box. Click the new item button, and an item 0 will appear. Set item0 to Chickenby clicking on the down arrow next to <None>, and selecting Chicken, and then the entire Chicken from the list. Add another item, and set it to Chicken2, and so on, until all of the chickens through Chicken6 are on the list. Then click OK. Making a List Moving the chickens together Now we will create a method to move the chickens together using the list. Create a world-level method called chickenstogether. Find the For all together button at the bottom of the method editor, and drag it into chickenstogether. From the menu that pops up, select expressions, then world.chickens DanceTogether. World.chickensTogether Drag a Do in order into the For all together statement. Add the following code inside the Do in order. This code will make a chicken roll left, then right, then left. Use any chicken to write this code, it doesn t matter which one, because we will be replacing it soon. For our example, we have used Chicken. 2

Now drag the button labeled item_from_chickensdancetogetherover the button labeledchicken. This means that instead of just Chicken executing this method, now each chicken from the list will execute it together. Drag item_from_chickensdancetogether over each of the other two buttons labeled Chicken so that each chicken performs the whole sequence of methods. Now we have programmed the list to have all the chickens roll left and then right at the same time. Drag world.chickenstogether into world.my first method and then play your world to make sure your code does this. Now what if we want them to do something one at a time? This is where For all in order comes in. We will now program the chickens to each kick up their left leg, one at a time. Find the For all in order button at the bottom of your method editor and drag and drop it into your world.chickenstogethermethod. Select expressions, and then world. Chickens Dance Together. Drag a Do in order into the For all in order statement. Add the following code inside the Do in order. We will modify this code so that it makes each chicken kick up their left leg. Use any chicken to write this code, it doesn t matter which one, because we will be replacing it soon. For our example, we have used Chicken. 3

Part Named Key Go to the chicken s functions tab. Scroll down until you see the function Chicken s part named key. Drag this function into your method editor and drop it over Chicken on each of the lines of code in the For all in order. This function can be used to make only a part of an object in a list move, instead of the whole thing. Click on the plus sign next to Chickenin the object tree so that you can see the parts of the chicken. Now, click on the down arrow next to the word named on the first Chicken s part named statement. Select other. Type in LeftLeg, exactly how it is spelled in the object tree, with the same capitalizations. Do the same thing to the other Chicken s part named statements. Part Named Key Part named key Now, click on the item_from_chickensdancetogether button at the top of the For all in order statement, and drag and drop it over the word Chicken in the first Chicken s part named LeftLeg statement. This will make each object in the list s left leg execute this line of code one at a time, instead of just Chicken. Do the same thing for the other two lines of code in the For all in order. Play your world to see the results. Now that this portion is programmed,all the chickens will roll right and then left at the same time for the For all together code, and kick up their legs one at a time for the For all in order code. This saves lots of time and lines of code. Imagine if we had to program each chicken to do this individually! 4

List Visualizations For future reference, there is an object called ListVisualization that is a visual representation of the list that your objects are in that you can drop into your world. Do not do this right now, because it will cause problems for the array that we will be creating shortly. If you were to enter all of the chickens into a ListVisualization, they would be aligned in a row that looks like this. If you wanted your chickens to stay in their neat line, but did not want to see the ListVisualization, you could set its isshowingto False. are great for coding a group of objects to all do the same thing (either together or one at a time). But what if we want to code only some of the objects in our group to do something? This is where arrayscome in. The following slide will show the place that you need to go to find the array. It is called ArrayVisualization. Click on Add Objects. Scroll across until you see a folder called Visualizations. The first object on the left should be a class called ArrayVisualization. It should look like a strip of concrete. Add one of these to your world. Starting the Array We are going to use our array for the chickens. When you add the ArrayVisualizationto your world, this box labeled Initialize Array will appear. Count the number of chickens you have and click the new item button that many times. The array will start counting at 0, so the number on your last item button will be one less than how many chickens you have. Starting the Array 5

Enter your chickens into the array in the same way that you did for the list. Once you have done so, your box should look like this. If it does, click OK. If not, use the Undobutton at the top left of your screen and try again. Once you click OK, your chickens should be neatly lined up on the array. You may have to re-position the chickens a bit so that they are all showing on the screen. Click on your ArrayVisualization and then go to its properties tab. Set its isshowing property to falseto hide your ArrayVisualization so that the chickens do not look like they are standing on anything. Even though it is invisible, the array is still there and functional. Drag a Do Together into your chickenstogether method. Then, drag the following code into the Do Together. Use any chicken when writing this code, we will be replacing it shortly. You can do it by writing the line of code once, and then right-clicking on it and copying it until there are 6. Continued Now click on ArrayVisualizationin the object tree, and go to its propertiestab. Click on the button at the top that says elements, and drag and drop it on top of Chickenin the first line of code in your Do together. Select the number 0from the list of numbers. This represents the object that is in the 0slot of the array. 6

Continued Do this for each of the lines of code in the Do together, selecting the number in order through number 5. Your code will look like this when you ve finished. Getting Chickens to do different things Right now, each chicken in the array is doing the same thing at the same time. Let s use the array to make only half of the chickens do something. Add two more Do Togethersto your chickens Together method, one right below the other. 4 Enter the code seen below into the two Do togethers, using the same method as for the previous code. Note that only chickens in the 0, 2, and 4slots are going to move. This is the beauty of the array! It allows you to only move selected objects in your array, whereas with the list you must move everything. Play your world. The latest addition should look something like the picture below. Only the chickens in the even numbered slots are moving. 7

Recap After finishing this tutorial, you can see how lists and arrays can be used interchangeably to animate your Alice world. The For all together command for lists allows you to animate a group of objects to do something together. The For all in order command for lists allows you to animate the whole group of objects to do the same thing, but one at a time. The array allows you to have a group of objects do different things. 8