Programming in Alice Chapter 2 Part 2. Events Editor Identifies what method is executed (run) when the “Play” button is hit 2.

Slides:



Advertisements
Similar presentations
Objects in Alice: Positioning and Moving Them By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
Advertisements

Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
Class-level Methods Alice. World / Class Method World method A general method that may refer to multiple objects; not closely associated with any particular.
Class-level Methods Chapter 6. Class-level Method Is specific to a class of objects We can give a class new abilities/methods Only involves this one class.
PIIT Computer Science Summer Camp - Alice July 10, 2012 Brenda Parker Computer Science Department MTSU.
Events Chapter 7. Interactive Real world is interactive User determines order of actions instead of programmer.
Lets Play Catch! Keeping Score in Alice By Francine Wolfe Duke University Professor Susan Rodger May 2010.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Exam Wednesday No inclass assignment this week. Friday labs will help with individual homework assignment due Friday midnight Review for exam –Tuesday.
1 Alice: Beyond the Basics Steve Cooper Michelle Venable-Foster Barbara Ericson May 2007.
1 Alice: Beyond the Basics Steve Cooper Michelle Venable-Foster Barbara Ericson Aug 2009.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Alice: A Visual Introduction to Programming Chapter 1 Part 3.
Programming in Alice Chapter 2. Today’s Agenda Designing a Program Writing Methods Executing Instructions Simultaneously Comments Tips for Setting Up.
Exploring Events. Try this Start Alice and create a blank world using the grass template. Add an instance of a BlueBallerina. Add an instance of a PinkBallerina.
Alice: A Visual Introduction to Programming Chapter 1 Part 2.
Copyright 2011 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Implementation Algorithm  Code World.my first method Control blocks Statements (methods,
Alice: A Free 3D Animation World for Teaching Programming Barbara Ericson Georgia Institute of Technology Oct 2005.
01-Intro-Object-Oriented-Prog-Alice1 Barb Ericson Georgia Institute of Technology Aug 2009 Introduction to Object-Oriented Programming in Alice.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running o Stored in.
Programming Alice Alice is named in honor of Lewis Carroll’s Alice in Wonderland.
Using Alice to Introduce Programming Concepts Mr. Craig Ham Technology Coordinator Westminster Schools of Augusta Augusta, GA.
Getting Started With Alice By Ruthie Tucker under the direction of Prof. Susan Rodger Duke University, July
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
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.
Motion and Rotation. 3 Dimensional Space  An Alice object o Is located in a 3D world, positioned at (x, y, z) o has 3 dimensions o height, width, depth.
3–D Helium Molecule Tutorial Alice Project Duke University Professor Susan H. Rodger Gaetjens Lezin June 2008.
Graphics Movies & Games. Jump In! Feeling sleepy and stupid… Extract the Alice from the zip archive and copy it to C:\Programs.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
Getting started with Alice Adapted from presentations by Jenna Hayes, Duke University Donna Gavin, UWP Computer Science and Software Engineering.
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
Creating An Animation Program Part 2 Alice. Method A segment of program code (instructions) that defines how to perform a specific task.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
XP New Perspectives on Microsoft Word 2002 Tutorial 31 Microsoft Word 2002 Tutorial 3 – Creating a Multiple-Page Report.
CS329e – Elements of Visual Programming Implementing Programs Mike Scott (Slides 2-2)
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.
Alice: A Visual Introduction to Programming Chapter 1 Part 2.
Alice Tutorial: Overview and Concepts Wayne Summers Columbus State U. 11/17/06.
By Deborah Nelson Duke University Professor Susan Rodger July 13, 2008.
Lists Tutorial By Deborah Nelson Duke University Professor Susan Rodger July 13, 2008.
An Introduction to Alice (Short Version) – Extras! Yossra Hamid Under the Supervision of Professor Susan Rodger Duke University, June 2014 This is a continuation.
Skater World: Part Two By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 1,
Alice 3.0 A Guided Tour Mike R-D YRDSB. Agenda General Walkthrough of Alice 3.0 Loops, Variables, Threads Methods / Properties Arrays Misc.
Review: the Dummy Marker Typically used for: Positioning large and small objects in a scene Remembering camera positions for multiple scenes Remembering.
An Introduction to Alice By Jenna Hayes under the direction of Professor Susan Rodger Duke University, June 2009 Updated June 2014 by Ellen Yuan.
Alice: A Free 3D Animation World for Teaching Programming.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Illuminating Computer Science CCIT 4-6Sep
Headshots in Alice Duke University Professor Susan H. Rodger Gaetjens Lezin July 2008.
An Introduction to Programming Using Alice 2.2, Second Edition Chapter 7 Recursive Algorithms.
Chapter 2: Programming in Alice
Setting Up the Initial Scene. Problem Solving in Alice Set up the initial scene in a new world The princess example Setting up the initial scene.
CS0007: Introductory Programming Rotational Motion.
Programming in Alice Chapter 2.
Setting Up the Initial Scene
Graphics Movies & Games
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Tutorial 3 – Creating a Multiple-Page Report
Objects in Alice: Positioning and Moving Them
Chapter 2: Programming in Alice
An Introduction to Alice
An Introduction to Programming Using Alice 2.2, Second Edition
Introduction to Object-Oriented Programming in Alice
Alice 2.2 Introduction.
Getting Started With Alice
Alice and Daisies: Positioning and Moving Objects in Alice
Class-level Methods and Inheritance
Presentation transcript:

Programming in Alice Chapter 2 Part 2

Events Editor Identifies what method is executed (run) when the “Play” button is hit 2

Deleting Instructions  Right-click the instruction and select delete  Drag the instruction tile to the trash can 3

Copying Instruction  Right-click the instruction and select make copy  Drag the instruction tile to the clipboard o When the clipboard turns green, drop the tile o Click on the clipboard and drag it back to the Method Editor 4

Objects With Custom Methods  In addition to primitive methods some objects have custom methods  When objects are selected from gallery, a listing of custom methods appears  Names of the custom methods give clues as to what the method does What do you think the foottap custom method does? 5

Naming Conventions  Names are known as identifiers because they identify items in a program  Use a name that provides meaning o Name of method should indicate the method’s purpose 6 Which one coaches the Knights and which one coaches the Cougars?

Naming Conventions  Dot notation o world.my first method  Dot (period) separates pieces of information o Left side: object that the method belongs to  The WORLD object in this case o Right side: name of the method  “my first method” in this case 7 the period is called a “dot”

8 Naming Conventions  Most programming languages do NOT recognize spaces o Alice allows spaces, good practice to not use them method.my first method  Without spaces, how do you have more than one word in names? o Lower case first letter o Capitalize first letter of next words o Called camelCase (camel’s hump) Note the space Which is easier to read? onehumpcamel or oneHumpCamel

Class Names  Method names begin with a lower case letter  Class names are capitalized  No spaces, so each word is capitalized o This convention is called PascalCase 9

Renaming  Objects o Right-click object’s tile in the object tree and select rename  Custom methods o Select the world object o Select the methods tab from the Details Panel o Right-click the my first method tile and select rename o If right-click does not work then hit Control & click 10

Orientation and Movement A translation in computer graphics o Moves an object a specified distance in a specified direction o Move instruction in Alice moves object  Left, right, up, down, forward, backward All movements of objects are egocentric o They move from their perspective, not ours 11

Pivot Point Examples Center of rotation 12

Turn Method Causes rotational motion Can turn an object o Left, right – similar to turning door on hinges  Along the horizontal plane o Forward, backward – lifting or closing hinged lid on a box  Along the vertical plane forward and backward 13

Roll Method Object is rotated left or right o Along the vertical plane clockwise or counter-clockwise Rotation depends on where center is 14

Subpart Rotation Center for rotational motion is where subpart connects to object o Also called a pivot point Turn rotation of Monkey’s left arm subpart 15

Orient to Method Used when two objects need to move together synchronization Objects might be pointing in different directions Use orient to method to align them o Argument is object to orient to method Forward Notice change orientation of ball changed 16

Circling Other Objects  Object’s turn method spins the object around o Can also get an object circle around another object  The asSeenBy optional argument causes an object to turn around the asSeenBy’s objects center point  Example: hawk turns one complete revolution around the tree from the tree’s perspective 17

Facing and Pointing Objects Turn to face o Causes object to turn toward another object Point at o Aligns two objects from the center of one to center of other o Centers are not always in good spot  They could collide in odd places or cause odd movement 18

“Move to” Instruction Moves an object to another object o Instead of a distance with move instruction The centers of both objects align They will look like they collide o Better to use “move toward” instruction o Need to know distance though and be careful of center Be very careful when “move toward” instruction o Will match center of both objects together o If centers are at different heights the object will be moved off ground or into ground to align centers o Use “turn to face” object then move distance to object 19

Exporting Code for Printing 20 Code can be exported to an HTML file From File – Choose Export Code for Printing You MUST add your name as the author o Author’s name is printed with the exported code Author’s name

Homework Read chapter 2 Answer questions in handout Do lab assignments after handing in algorithms Due one week after assigned with 1 week grace 21