Alice: A Visual Introduction to Programming Chapter 1 Part 2 Objects Alice uses objects o o o Tent Soldier Princess Objects perform actions – Turn – Move – Fly – Wave 1-2 The Alice System 1-3 Open SnowLove in Examples 1-4 Executing Alice Program PLAY 1-5 Controlling Runtime Speed Can increase speed of program Move slider of speed control Useful when troubleshooting to skip over parts of program that work Max of 10x normal 1-6 The Alice Environment Scene Editor or World View Toolbar Object Tree Details Panel Events Editor Tile Tile Method Editor 1-7 Checkpoint How do you control the speed of an Alice program that is being played? What part of the Alice environment displays a view of the world? What part of the Alice environment displays a list of objects in the world? What is a tile? 1-8 Objects Anything that can be identified as unique from other things How is an object unique? o o Has a name Has properties Color, o opacity, etc. Can perform actions (methods) Associated actions (move, turn , think, etc.) Tasks it can carry out 1-9 Object Properties Object Selected Object Selected Change Properties 1-10 Opacity How transparent an object is o Less opaque an object, more transparent Opacity of 100%, cannot see through the object Opacity of 0%, object is completely transparent Like clear glass An object with opacity of 0% is invisible A partially transparent object can be used to o o Make something look far away in water Have a ghostly appearance 1-11 Objects and Object Parts Objects are made of other subparts Snowman made of: o head topHat leftEye rightEye carrotNose mouth leftArm o rightArm o Bottom Objects named in “camel Case” format o o o 1st letter is lower case Upper case next word’s 1st letter 1-12 Methods Methods o o Set of instructions to perform task Default method world.my method first 1-13 Methods Each object and its subparts can be manipulated with methods o o o o Move Turn Roll Say… 1-14 The World is an Object Contains all other objects Also has its own properties o o o Atmosphere color Lighting Fog 1-15 Checkpoint What are properties? What is the name of a property that o o Determines an object’s color? Allows you to see through an object? What is a method? What do you call a part of an object that can move by itself? 1-16 Alice has Class(es) Objects are created from classes Blueprint that describes a particular “type” of object Defines a particular kind of object Animals Collection 1-17 Classes Gallery - collection of different object types (animals, beach, people, etc.). Class - each item found in the Gallery Two galleries are used o o Local gallery (stored on computer) Web gallery (maintained by creators of Alice) 1-18 Class Instance in Alice Class: Chicken Instance: An object that is created from a class Examples o o o Chicken Chicken2 Chicken3 Each instance has its own properties, methods, functions Can manipulate each one individually 1-19 Creating a New World • Create a new world o o File New Choose template 1-20 Adding Objects Click on Add Object 1-21 Adding Objects: Scene Editor Click on People collection thumbnail 1-22 Add Coach Place object in scene editor by Clicking on it o Or drag it o 1-23 1-23 Coach Object With Bounding Box 1-24 Saving Alice World Click on File then Save World Has .a2w extension 1-25 Demo: Saving a world Writing and testing an animation is an intense load on the computing system o Crashes can occur Best solution Save your world every 15 minutes Also save to a backup system Ex: USB flash drive 1-26 Checkpoint What is a class? Are classes or objects stored in Alice galleries? What are two ways to add an object to a scene? What appears around an object when selected? Where do you find an object’s properties? 1-27 3D Objects and the Camera Alice world and objects are threedimensional } Height 2D o Width objects – Depth – 3rd dimension o 1-28 3D Movement Forward is based perceived as the object getting Motion is on OBJECT’s larger as it gets closer us.Coach’s right perspective…our left istothe Backward is perceived as the object getting smaller as it gets farther away from us. 1-29 The Camera When you create an Alice world a camera is automatically placed in the world Displays image of world in Scene Editor window o Called camera viewpoint 1-30 Camera Controls Drive forward, backward, turn left and right Move camera up, down, left, right You can make camera move faster by dragging mouse pointer away from center of camera control Tilt camera up, down 1-31 Different World Perspectives Sometimes difficult to tell where object is in relation to other objects Fish looks like it should be in water Change world perspective o Look at fish from perspective of water instead of sky Also called Camera control or point of view 1-32 Homework Read chapter 1 Do tutorials o o o Tutorials 1-1, p 6 Tutorials 1-2, p. 19 Tutorials 1-3, p. 34 Due one week after assigned with 1 week grace 1-33