Download presentation
Presentation is loading. Please wait.
Published byJoleen Young Modified over 9 years ago
1
Introduction to Programming with Alice
2
Learning how to program in the context of animation, simulation, storytelling, and building short games. Learn fundamental programming concepts in Alice ◦ A rapid prototyping tool ◦ Create “rough drafts” of animations, games simulations, and film-like stories Description
3
Software (available online, freeware) ◦ Alice 3.1 ◦ Java 1.7 or laterwill be used later ◦ Dr. Java All are available free online. See course description for instruction if you want to download them at home. Tools
4
A Brief Tour An Overview of Alice 3
5
Start Alice 3 This screen should appear. Select whichever template you like.
6
This screen should now appear Code editorScene view Methods panel Control tiles
7
Methods Panel Methods panel Code editorScene view Methods panel Control tiles The methods panel contains a set of tiles. Each tile describes an action an object can perform (or have performed on it)
8
Where the program for the animation or game is written Code Editor Code editorScene view Methods panel Control tiles
9
Where the world is set up for the animation or game. Scene View Code editorScene view Methods panel Control tiles
10
Alice World An Alice project creates a virtual world. The primary component of a world is a scene, as shown in the Scene Editor.
11
this The current scene is known as “this” scene
12
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.
13
Click on Setup Scene to go to the Scene Editor Go to Scene Editor
14
Scene Editor Where the scene for the animation or game is created Scene setup panel Gallery panel, organized by class hierarchy
15
Gallery Tour An Overview of the Alice 3 Gallery and Classes
16
Each 3D model is a pre-written class In Alice, a class defines ◦ A plan for constructing a new object in an Alice scene ◦ Actions an object of that class can perform
17
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.
18
An instance of a class is an object The following slides illustrate how to create (construct) a new object in an Alice scene.
19
Gallery panels The gallery tabs provide alternate organization schemes
20
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)
21
Adding Objects An Overview adding an object to an Alice Project
22
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
23
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
24
Click on the image to select one of 10 versions of objects that can be created by the DragonBaby class. Select class 10 different versions of DragonBaby objects
25
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
26
Enter a name for the new BabyDragon object Adding a DragonBaby object to a Scene
27
We have constructed a new instance of the DragonBaby class and identified it with the name fergie. We say an instance of a class is an object. Instance/object
28
Naming Conventions Meaningful names Most languages do not allow spaces in names so we will not use them
29
Naming Conventions Pascal Case Each word starts as upper case Used for classes Ex. IceSkater, DragonBaby Camel Case First word lower case, other words upper case Used for objects – instances of a class, and methods Ex. blackBeauty, fergieTheBabyDragon
30
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
31
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 DragonBaby class. Different objects have different names and may have different colors, sizes, and other properties.
32
Scene Editor -- Object tree In the scene editor, Alice generates an object tree to show a list of all objects in this scene. Click on Edit Code to return to the Code Editor
33
Code Editor – Object list In the code editor, Alice generates a corresponding list of objects in a pull-down menu. Object menu Object tree
34
Ancestry Each object in the scene is an instance of a class that belongs to a family of classes. The class’s ancestry is shown in the methods panel.
35
Inheritance: Order DragonBabyQuadruped Ancestry can be ordered from specific to most generic (similar to youngest to oldest).
36
The ancestry list tells you that fergie is an instance of the DragonBaby class… inherits all properties and methods of the Quadruped class Why do you care?
37
In computer science, we often use a more abstract representation of class inheritance, known as a class hierarchy. Model |-JointedModel ├ SQuadruped ├ Quadruped ├ DragonBaby Class hierarchy Note that fergie is NOT specified in the class hierarchy because fergie is an object, NOT a class. Not shown in Methods Panel
38
Now you have time to play Create a world and add some objects Explore the gallery to see what classes are available Check out any other features of the scene editor
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.