Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

23
Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved

Transcript of Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Page 1: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Classes and Objects

Copyright 2014 Wanda Dann, Don SlaterAll rights reserved

Page 2: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

An Alice World

Classes

Objects

Page 3: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Alice World

An Alice project creates a virtual world.The primary component of a world is the

camera view, as shown in the Scene Editor.

Page 4: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

this

The current scene is known as “this” scene

Page 5: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Components of a scene A scene always has a camera and a ground

surface (which may be grass, sand, rocks, or even water)

Other objects may be added to a scene.

Page 6: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Where the program for

the animation or

game is written

Code Editor

Page 7: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Click on Setup

Scene to go to the Scene Editor

Go to Scene Editor

Page 8: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Scene Editor

Where the scene for the animation or

game is created

Gallery panel, organized by class hierarchy

Page 9: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Video: 02. Gallery TourAn Overview of the Alice 3 Gallery and Classes

Page 10: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Each 3D model is a pre-written classIn Alice, a class defines

◦ A plan for constructing a new object in an Alice scene

◦ Actions an object of that class can perform

Page 11: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

An Alice class is similar to an architect's blueprint for building a house.◦ Not the actual house -- just a plan for

constructing a new house, based on a sketch of what it will look like.

Page 12: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

An instance of a class is an objectThe following slides illustrate how to create

(construct) a new object in an Alice scene.

Page 13: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Gallery panels

The gallery tabs provide alternate organization schemes

Page 14: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Class Hierarchy• In this panel, classes are organized based on how objects

move around in a scene.• 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)

Page 15: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Video: 03. Adding ObjectsAn Overview adding an object to an Alice Project

Page 16: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Select the class folder for the type of object that you wish to add to the scene.

In this example, we click on Quadruped classes.

Select class folder

Page 17: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

• Within the Quadruped folder are classes of objects that move around on 4 legs.

• Each image is labeled with the name of the class and shows a preview for a new object of that class.

Quadruped – walks on 4 legs

Page 18: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Click on the image to select one of 5 versions of objects that can be created by the DragonBaby class.

Select class

10 different versions of DragonBaby objects

Page 19: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

• The DragonBaby class has 10 different paint resources.• Click on one of the images to select one of the paint

resources. Alice will automatically create a new DragonBaby object and paint it with the selected paint resource.

Select class

Page 20: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Enter a name for the new BabyDragon object

Adding a DragonBaby object to a Scene

Page 21: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

• We have constructed a new instance of the BabyDragon class and identified it with the name fergie.

• We say an instance of a class is an object.

Instance/object

Page 22: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

• A new object may be added to a scene by clicking and dragging the image into the scene. The dialog box for naming the object will still pop up, in the same way as before.

Alternate technique

Page 23: Classes and Objects Copyright 2014 Wanda Dann, Don Slater All rights reserved.

Objects of the same class

• A scene may have more than one object of the same class.

• Example: fergie and bert are two different objects (instances) of the same BabyDragon class. Different objects have different names and may have different colors, sizes, and other properties.