Download presentation
Presentation is loading. Please wait.
Published byImogen Hodges Modified over 9 years ago
1
Wanda Dann wpdann@andrew.cmu.edu Don Slater dslater@cmu.edu Classes and Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved
2
Alice Environment Scene Editor Code Editor Classes Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved
3
Each 3D model is a pre-written class In Alice, a class defines ◦ A plan for constructing an object in an Alice scene ◦ Actions an object of that class can perform Copyright 2012 Wanda Dann, Don Slater All rights reserved
4
An Alice class is similar to an architect's blueprint for building a house. ◦ Not the actual house -- just a plan for constructing a house, based on a sketch of what it will look like. Copyright 2012 Wanda Dann, Don Slater All rights reserved
5
An instance of a class is an object The following slides illustrate how to create (construct) an object in an Alice scene. Copyright 2012 Wanda Dann, Don Slater All rights reserved
6
Where the program for the animation or game is written Code Editor Copyright 2012 Wanda Dann, Don Slater All rights reserved Code editorScene view Methods panel Control tiles
7
Click on Setup Scene to go to the Scene Editor Go to Scene Editor Copyright 2012 Wanda Dann, Don Slater All rights reserved
8
Scene Editor Copyright 2012 Wanda Dann, Don Slater All rights reserved Where the scene for the animation or game is created Scene setup panel Gallery panel
9
Gallery folders In the gallery, classes are organized in folders. Each class folder is like a drawer in a file cabinet, where all classes of the same type are stored. Flyer (has wings and can fly) Biped (walks on 2 legs) Quadraped (walks on 4 legs) Swimmer (lives in water, swims) Copyright 2012 Wanda Dann, Don Slater All rights reserved
10
Select the class folder for the type of object that you wish to add to the scene. In this example, we click on Quadruped. Select class folder Copyright 2012 Wanda Dann, Don Slater All rights reserved
11
Within the Quadruped folder are images of each class in this folder. Each image is labeled with the name of the class and shows a preview for an instance of that class. Quadruped – walks on 4 legs Copyright 2012 Wanda Dann, Don Slater All rights reserved
12
Click on the image to select one of 5 versions of the BabyDragon class. Select class Copyright 2012 Wanda Dann, Don Slater All rights reserved 5 different BabyDragon classes
13
Click on the image to create a new BabyDragon object Select class Copyright 2012 Wanda Dann, Don Slater All rights reserved
14
Enter a name for the new object you are constructing from the BabyDragon class Adding a Camel object to a Scene
15
We have constructed an instance of the BabyDragon class and identified it with the name fergie. We say an instance of a class is an object. Instance/object Copyright 2012 Wanda Dann, Don Slater All rights reserved
16
An instance of an object may be added to a scene by clicking and dragging the image into the scene view. Instance construction - Alternative
17
Instances of same class Can have more than one instance of the same class. Example: fergie and bert are two instances of the BabyDragon class.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.