wanda dann don slater classes and objects copyright 2012 wanda dann, don slater all rights reserved

17
Wanda Dann [email protected] Don Slater [email protected] Classes and Objects Copyright 2012 Wanda Dann, Don Slater All rights reserved

Upload: imogen-hodges

Post on 17-Jan-2018

225 views

Category:

Documents


0 download

DESCRIPTION

 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

TRANSCRIPT

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

Wanda [email protected]

Don [email protected]

Classes and Objects

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

Alice EnvironmentScene EditorCode Editor

Classes

Objects

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

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 SlaterAll rights reserved

Page 4: Wanda Dann Don Slater Classes and Objects Copyright 2012 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 house, based on a sketch of what it will look like.

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

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

(construct) an object in an Alice scene.

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

Where the program for

the animation or

game is written

Code Editor

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

Code editorScene view

Methods panel

Control tiles

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

Click on Setup

Scene to go to the Scene Editor

Go to Scene Editor

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

Scene Editor

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

Where the scene for the animation or

game is created

Scene setup panel

Gallery panel

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

Gallery foldersIn 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 SlaterAll rights reserved

Page 10: Wanda Dann Don Slater Classes and Objects Copyright 2012 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.

Select class folder

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

• 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 SlaterAll rights reserved

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

Click on the image to select one of 5 versions of the BabyDragon class.

Select class

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

5 different BabyDragonclasses

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

Click on the image to create a new BabyDragon object

Select class

Copyright 2012 Wanda Dann, Don SlaterAll rights reserved

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

Enter a name for the new object you are constructing from the BabyDragon class

Adding a Camel object to a Scene

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

• 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 SlaterAll rights reserved

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

• An instance of an object may be added to a scene by clicking and dragging the image into the scene view.

Instance construction - Alternative

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

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.