43
Alice: A Visual Introduction to Programming Chapter 1 Part 2

Alice: A Visual Introduction to Programming

  • Upload
    deliz

  • View
    57

  • Download
    1

Embed Size (px)

DESCRIPTION

Alice: A Visual Introduction to Programming. Chapter 1 Part 2. Objects. Alice uses objects Tent Soldier Princess Objects perform actions. Turn. Move. Fly. Wave. The Alice System. Open SnowLove in Examples. Executing Alice Program. PLAY. Controlling Runtime Speed. - PowerPoint PPT Presentation

Citation preview

Page 1: Alice:  A Visual Introduction to Programming

Alice: A Visual Introduction to Programming

Chapter 1 Part 2

Page 2: Alice:  A Visual Introduction to Programming

Objects Alice uses objects

o Tento Soldiero Princess

Objects perform actions

1-2

– Turn

– Move

– Fly

– Wave

Page 3: Alice:  A Visual Introduction to Programming

The Alice System

1-3

Page 4: Alice:  A Visual Introduction to Programming

Open SnowLove in Examples

1-4

Page 5: Alice:  A Visual Introduction to Programming

Executing Alice Program

1-5

PLAY

Page 6: Alice:  A Visual Introduction to Programming

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

Page 7: Alice:  A Visual Introduction to Programming

The Alice Environment

1-7

Toolbar

Object Tree

DetailsPanel

TileTile

Page 8: Alice:  A Visual Introduction to Programming

Review

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

Page 9: Alice:  A Visual Introduction to Programming

Objects

Anything that can be identified as unique from other things

How is an object unique?o Its nameo Its propertieso The custom methods or actions it can

perform

1-9

Page 10: Alice:  A Visual Introduction to Programming

Properties

Values that specify an object’s characteristics

Can adjust them in the properties part of the details pane for an object

Examples: Color, opacity, etc.

Page 11: Alice:  A Visual Introduction to Programming

Object Properties

1-11

Object Selected

Change Properti

es

Object Selected

Page 12: Alice:  A Visual Introduction to Programming

Opacity

How transparent an object iso 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 too Make something look far away in watero Give a ghostly appearance

1-12

Page 13: Alice:  A Visual Introduction to Programming

Objects and Object Parts

1-13

Objects are made of other subparts

Snowman made of:o head

topHat leftEye rightEye carrotNose mouth

o leftArmo rightArmo Bottom

Page 14: Alice:  A Visual Introduction to Programming

Methods Methods

o Set of instructions to perform task

o Can just be oneo Default method

world.my first method

1-14

Page 15: Alice:  A Visual Introduction to Programming

Methods

Each object and its subparts can be manipulated with methodso Moveo Turno Rollo Say…

1-15

Page 16: Alice:  A Visual Introduction to Programming

The World is an Object

Contains all other objects

Also has its own propertieso Atmosphere coloro Lightingo Fog

1-16

Page 17: Alice:  A Visual Introduction to Programming

Review

What are properties? What is the name of a property that

o Determines an object’s color?o Allows you to see through an object?

What is a method? What do you call a part of an object

that can moved independent of the main object?

1-17

Page 18: Alice:  A Visual Introduction to Programming

Alice has Class(es)

Objects are created from classes

Blueprint that describes a particular “type” of object

1-18

Animals Collection

Page 19: Alice:  A Visual Introduction to Programming

Classes Gallery - collection of different object types

(animals, beach, people, etc.). Class - each item found in the Gallery Two galleries are used

o Local gallery (stored on computer)o Web gallery (maintained by creators of Alice)

1-19

Page 20: Alice:  A Visual Introduction to Programming

Class Instance in Alice Class: Chicken Instance: An object that

is created from a class Examples

o Chickeno Chicken2o Chicken3

Each instance has its own properties, methods, functions

Can manipulate each one individually

1-20

Page 21: Alice:  A Visual Introduction to Programming

Creating a New World

• Create a new worldo File Newo Choose template

1-21

Page 22: Alice:  A Visual Introduction to Programming

Adding Objects

Click on Add Object

1-22

Page 23: Alice:  A Visual Introduction to Programming

Adding Objects: Scene Editor

1-23

Click on People collection thumbnail

Page 24: Alice:  A Visual Introduction to Programming

Add Coach Place

object in scene editor byo Clicking on

it Placed in

default position

o Or drag it You choose

the place to position it

1-24

1-24

Page 25: Alice:  A Visual Introduction to Programming

Coach Object With Bounding Box

1-25

Page 26: Alice:  A Visual Introduction to Programming

Saving Alice World Click on File then Save World

Has .a2w extension

1-26

Page 27: Alice:  A Visual Introduction to Programming

Demo: Saving a world

Writing and testing an animation is an intense load on the computing systemo Crashes can occur

Best solution Save your world every 15 minutes Also save to a backup system

Ex: USB flash drive

1-27

Page 28: Alice:  A Visual Introduction to Programming

Review 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-28

Page 29: Alice:  A Visual Introduction to Programming

3D Objects and the Camera

Alice world and objects are three-dimensionalo Heighto Width

1-29

oDepth – 3rd dimension

Page 30: Alice:  A Visual Introduction to Programming

3D Movement

1-30

Motion is based on OBJECT’s perspective…our left is the Coach’s right

Forward is perceived as the object getting larger as it gets closer to us.Backward is perceived as the object getting smaller as it gets farther away from us.

Page 31: Alice:  A Visual Introduction to Programming

The Camera

When you create an Alice world a camera is automatically placed in the world

Displays image of world in Scene Editor windowo Called camera viewpoint

1-31

Page 32: Alice:  A Visual Introduction to Programming

Camera Controls

Drive forward, backward, turn left and right

Move camera up, Tilt camera up, downdown, left, right

You can make camera move faster by dragging mouse pointer away from center of camera control

1-32

Page 33: Alice:  A Visual Introduction to Programming

Different World Perspectives Sometimes it is

difficult to tell where object is in relation to other objects

Fish looks like it should be in water

Change world perspectiveo Look at fish from

perspective of water instead of sky

Also called Camera control or point of view

1-33

Page 34: Alice:  A Visual Introduction to Programming

Modifying Objects

1-34

Use Mouse Mode Buttons

Page 35: Alice:  A Visual Introduction to Programming

Modify Objects

1-35

Move Freely

Move Up and Down Turn Left

and Right Tumble

Copy

ResizeTurn Forward and Backward

When checked can modify subparts

Page 36: Alice:  A Visual Introduction to Programming

Center of an object Provides pivot or spin

referenceo Object spins around center

At the center of mass Where it stands on the

ground

Where it is held

Page 37: Alice:  A Visual Introduction to Programming

Orientation When you click on

an object and rotate it you will notice arrowso Green points to up

from the objects perspective

o Red points to where object thinks its right is

o Blue is forward to the object

1-37

Page 38: Alice:  A Visual Introduction to Programming

Scene Editor Viewing Modes

Single Viewo Viewing scene from

World View angle Quad view

o View scene from four views

World View From top From right From front

o Allows you to position one object in relation to another object

1-38

Zoom

Scroll

Quad view

Page 39: Alice:  A Visual Introduction to Programming

Relational Positioning in Quad ViewNotice how rabbit is positioned in relation to chicken

1-39

From the right From the front

From the topWorld view

Scroll view

Zoom

Page 40: Alice:  A Visual Introduction to Programming

Using Coordinates Axes are measured in meters Point (0,0,0) is at center of the world Usually when an object is added to world by clicking

on class then clicking on add instance the object is placed at (0,0,0)

Can see position of an object in pointOfView property

1-40

X axis

Page 41: Alice:  A Visual Introduction to Programming

Coordinate System

1-41

Page 42: Alice:  A Visual Introduction to Programming

Homework Read chapter 1 Do tutorials 1-5 Exercises 1, 2, 3, 5 Due one week after assigned

1-42

Page 43: Alice:  A Visual Introduction to Programming

Homework Read chapter 1 Do tutorials

o Tutorials 1-1, p 6o Tutorials 1-2, p. 19o Tutorials 1-3, p. 34o Tutorials 1-4, p. 40o Tutorials 1-5, p. 43

Do exercises in hand out Due one week after assigned

1-43