7
CPSC 203 Tutorial Xin Nov 15, 2010

Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

Embed Size (px)

Citation preview

Page 1: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

CPSC 203 TutorialXin

Nov 15, 2010

Page 2: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

Introduction to AliceAlice

A very visible programming languageProgramming by dragging objects

InterfaceWorld window

The virtual world you are creatingObject tree

Objects organized in a tree structureDetails area

Details of the world or an object in the worldEditor area

What objects do / Action scriptEvents area

When objects act

Page 3: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

ExerciseRun the Quick Tutorial

Page 4: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

Detail AreaPropertiesMethods

The actionsFunctions

Query properties of an objectCan be used as arguments for methods

Move the skater forward by her height

Page 5: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

Exercise1. Open the file lab1.a2w. 2. Press the “Play” button to see what the world does. 3. Modify the 2nd instruction so that the shark rolls right by 2

revolutions. 4. Modify the 3rd instruction so that the shark says “I am hungry”. 5. Modify the 4th instruction so that the shark moves forward by

its distance to the blueminnow3’s tail – 0.5 6. Using functions, modify the 1st instruction so that the bigfish

moves forward by its distance in front of the shark’s jaw. 7. Using properties, make the blueminnow turn black then

disappear at the end of the instruction list. 8. Using methods, make the bigfish2 think “I should get out of

here”, after the blueminnow disappears.

Page 6: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

Exercise1. Create a new world using the green grass template. 2. Change the color of the grass to blue, so that it now

looks like an ocean. 3. Add an island object (from Environments) and a

goldfish (from Ocean). Make sure they are both visible. 4. Get the fish to roll left by 2 revolutions. 5. Resize the island by a scale of 1.5. 6. Using methods let the fish say “Yikes!” 7. Make the fish move forward by its distance in front of

the island * 1.5. 8. Change the color of the grass to dark gray.

Page 7: Xin Nov 15, 2010. Introduction to Alice Alice A very visible programming language Programming by dragging objects Interface World window The virtual world

ExerciseCreate a world using a snow template.

Add two snowwomen and one snowman to the scene.

A snowman is trying to meet a snowwoman who is talking to another snowwoman. He turns to face the snowwoman and says “Hello”. She turns to look at him then looks back at her friend, and continues to talk. The snowman’s face turns red, and he hangs his head down.