0% found this document useful (0 votes)
23 views47 pages

Programming in Alice

The document provides an overview of programming in Alice, an educational programming environment. It defines what a computer program is and describes basic programming concepts like sequential processing, conditional execution, looping, and functions. It then discusses what can be programmed in Alice, including scripted animations, interactive narratives, and games. The document outlines the main components of the Alice code editor, including the camera view, methods panel, code editor, and control panel. It describes the different types of methods in Alice like procedural and functional methods. The document also discusses parameters, required vs optional parameters, and how to select the object to apply procedures to.

Uploaded by

Carlos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views47 pages

Programming in Alice

The document provides an overview of programming in Alice, an educational programming environment. It defines what a computer program is and describes basic programming concepts like sequential processing, conditional execution, looping, and functions. It then discusses what can be programmed in Alice, including scripted animations, interactive narratives, and games. The document outlines the main components of the Alice code editor, including the camera view, methods panel, code editor, and control panel. It describes the different types of methods in Alice like procedural and functional methods. The document also discusses parameters, required vs optional parameters, and how to select the object to apply procedures to.

Uploaded by

Carlos
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 47

Programming In Alice

ONE
What is a Computer Program?
What is a Computer Program?

Defining a Computer Program

● A computer program is a set of instructions or statements that tell a device what to


do.

● Programmers generally write computer programs using programming languages


which can then be translated into machine code that can be executed by the device.
What is a Computer Program?

Basic Programming Ideas

● A program can be a list of instructions to follow in order (sequential processing).


● A program can be a direction to do something if something else happens (conditional
execution).
● A program can be instructions to repeat a behavior a certain amount of times or until something
happens (looping or iteration).
● A program can be a a set of directions that returns an answer to a question (function).
● A program can be a mixture of all of the above in differing amounts and combinations.
TWO
An Alice Program
An Alice Program

What Can You Program in Alice


The Alice programming environment was created
to help you program:

● Scripted animations or stories

● Interactive narratives or open worlds that


allow you to interact with objects and the
environment

● Games with win and lose conditions that


track and respond to interactions within the
world
An Alice Program

What is an Alice Program?

● Directions for how the computer will build


and display an environment

● Directions for what the happens in the world


and when it happens

● Directions for what the program should


listen to from outside the program (key
inputs, mouse interactions)
THREE
The Alice Code Editor
The Alice Code Editor

Code Editor Overview

The Code Editor is composed of:

● Camera View

● Methods Panel

● Editor

● Control Panel
The Alice Code Editor

Camera View

● Shows the scene from the starting


camera view position
● Allows for basic edits to the scene
using mouse and hotkeys (not
recommended)
● Contains the Setup Scene button that
navigates you to the full Scene Editor
● Contains the Run button to execute
your program
The Alice Code Editor

Methods Panel

The methods panel is where you will find code


blocks that are dragged into the editor to create
program statements and is composed of:

● An object list drop down menu

● A procedures tab (purple)

● A functions tab (green)


The Alice Code Editor

Code Editor

The Code Editor component is where you will


build your Alice program.

The Code Editor can be navigated using two


different ways:

● A navigation drop down menu (the yellow


hexagon)

● Clicking on the pages (the tabs across the


top)
The Alice Code Editor

Code Editor Tabs


There are 3 different types of Code Editor pages:

Methods – where you will build your program


starting with the my first method tab

Event Listeners – this is a custom method tab


where you will build ways for the code to handle
user inputs and trigger events in your world

Classes – yellow tabs that give you a summary of


all of the information for a class such as custom
methods
The Alice Code Editor

Control Panel
The control panel like the methods panel has
blocks that you drag into the Code Editor to build
your program. These elements are generally more
structural elements for your program like:

● Control structures for making loops and do


togethers

● Ways to create and manage variables

● Ways to add comments to plan and explain


your program
FOUR
Alice Methods
Alice Methods

What is a Method in Alice?

A method is a small defined set of code


within your program that gives instructions
for the program to do something.
Alice Methods

Two Types of Methods

There are two types of methods in Alice:

Procedural Methods - directions for how the


environment or objects in the environment should
behave such as “move forward”.

Functional methods – directions for getting


information from the environment or the user such
as “how far is the rabbit from the carrot”.
Alice Methods

Built in Procedures

Alice has a number of methods built into it that are


constructed to make animation easy. The built in
procedures cover the basics of:

● Moving objects in all the different directions


● Orienting or rolling and turning objects
● Orienting objects to each other
● Changing the environment (fog, sound, lighting)
Alice Methods

Alice is Object Oriented


In Alice, procedures are attached to the object they
are going to affect.

Navigate to the object you want to control to find


the methods associated with that object.

Different objects can have different built in and


custom procedures depending on the type.

For example, the scene object has atmospheric


procedures like setting fog density while a rabbit
has movement procedures like turn and roll.
FIVE
Alice Code Statements
Alice Code Statements

Parameters

When using built in procedures to create an Alice code


statement, parameters can be modified.

A parameter is an argument that informs what the method


will do.

Telling an object to move is confusing. Which way? How


far?

In this case direction and distance are parameters that


provide information needed for the procedure to have all of
the information it needs to execute.
Alice Code Statements

Required Parameters
Alice doesn’t allow you to create broken code (most of the
time).

When creating a statement Alice will require you to select


arguments for each of the required parameters so that it can
execute.

Drop down menus will guide you through selecting values


for all of the required parameters.

Don’t worry you can change these later without having to


rebuild the statement. In some cases, you will have to
choose a place holder and replace it later on.
Alice Code Statements

Optional Parameters
Alice has a number of parameters that can be added to
statements using the add detail dropdown. These can help create
necessary variations. For move procedures these are:

Duration – This parameter controls how long something


happens so you can change the default. By default, each
statement takes 1 second to execute.

Animation Style – This parameter allows you to control the


smoothness or abruptness something happens. By default, move
commands speed up and slow down over the execution to
smooth it out.

As seen by – This parameter allows you to modify the point of


reference to the camera or other objects. By default, moves are
relative to the object being manipulated.
SIX
Adding Procedures
Adding Procedures

Select the Object


Remember procedures are attached to objects. Be sure to
select the object you want to manipulate using the object
drop down menu.

If an object has joints like the playing card, as shown in the


image to the right, you can also select subJoints of the
object through the nested drop down by hovering over the
little arrow to the right of the object on the list.

Just like parameters, you can also change the object in a


statement as long as it is able to perform the procedure. Do
not worry if you accidentally chose the wrong object.
Adding Procedures

Create a Statement

Adding a statement is as easy as dragging and


dropping it into the Code Editor component.

Alice will guide you through filling in the required


arguments to complete the statement.
SEVEN
Running Your Program
Running Your Program

The Alice Player


To execute the program press the Run button and a
viewer will appear. The viewer allows you to:

● Resize the window by dragging a corner or


going full screen with the far right button.
● Speed up, slow down, and pause playback
help you navigate to different parts of the
program.
● Restart your program to run it again.
Running Your Program

Runtime Errors
Sometimes things will go wrong when you run your
program and you will see the angry queen or an error screen
instead of your program. Don’t worry this happens to
everyone.

The error screen should tell you what is wrong with your
program to help you go back and fix it. If you see red code
in your program this probably means there is an issue, such
as having deleted the object that is referenced.

Sometimes you can continue past the error and still run
your world.

It is a good idea to save your world before running it just in


case we can’t recover from the error.
EIGHT
Control Structures
Control Structures

Do In Order

Alice will follow the list of statements you provide


in the exact order you see them in your program.

Think of it like a recipe.

● Do this
● Then this
Control Structures

Do Together
Control structures allow you to change the
sequence or logic that controls the order and
timing of statements being run.

Often in Alice, you will want things happen at the


same time. This requires the do together control
block.

● Drag the do together block from the control


panel below the Code Editor into your
program.
● Add statements to the block that you want to
happen at the same time.
Control Structures

Nesting Control Structure


Often you will want things to happen in order for
one object at the same time as another set of
directions are executing in order for another
object.

This requires you to place control structures inside


control structures.

To have two objects jump at the same time you


need the move up and down code for each jump
inside do in orders that are inside the do together.

What would happen if you didn’t have the do in


orders?
NINE
Editing Code
Editing Code

Undo/Redo

You can always undo or redo work to easily test to see what will happen.

Use command/Ctrl z and command y to quickly undo and redo actions.

Windows Mac
Editing Code

Modifying Existing Statements

You can always go back and modify


arguments of existing statements.

Use the drop down arrows to access the


options for a parameter, including the ability
to change the object of the statement.
Editing Code

Reordering Statements

Changing your code can be as easy as


dragging statements to a different place in
the list.

You can also drag statements in and out of


control structures.
Editing Code

Deleting Statements

To delete a statement, click and drag the


statement and you will see a trash can
appear over the methods panel that you can
drag the statement into.

You can also right click and delete a


statement.
Editing Code

Copying and Duplicating Statements

Cut and Paste - You can drag statements into the


clipboard and drag them out to another location.

Copying - You can option click on mac or option


click on pc to drag and drop a copy of a statement
or whole code block and add it to another location.

You can then go back and change arguments to


quickly modify code without having to recreate
similar statements.
Editing Code

Disabling Code

You can enable and disable statements and code


blocks to help you test or experiment with
different code without having to add and remove it
every time.

Right click on a statement to bring up the enable


and disable toggle.

Disabled code will be ignored when the program is


executed.
TEN
Tips and Tricks
Tips and Tricks

Helpful Orientation Procedures

Alice provides a lot of helpful built-in orientation procedures that can be very useful for
moving objects to and from each other.

Move To Turn to Face Orient To


Tips and Tricks

Animating the Camera


The camera can be programmed to move just like any other object in the scene.

Use camera markers to plan for the positions and orientations of the camera. Then use the camera markers
to program the camera moves, adding dynamic changes to animations.

Change the duration of the camera move to have it pan slowly or jump to the new view (use 0)

Add a camera marker in Use moveAndOrientTo to


the scene editor program camera changes
Tips and Tricks

Scene Effects

Don’t forget about the unique scene procedures.


They can be used to create very cool
environmental effects such as flashing lightning or
rolling fog.
Tips and Tricks

Adding Sound
Adding sound can quickly transform an animation and
bring it to life using the playAudio procedure. There are a
couple different ways to easily add sound:

- Add a background audio track in a sceneActivated


listener to have it run during your animation
- Add sound effects for movements using a do
together
- Add voice overs by recording your own audio and
matching it to mouth movements

The Alice project supplies a number of audio files with


Alice that can be explored.
Tips and Tricks

Incremental Development
Alice is meant to be a platform that allows you to quickly iterate your designs. Don’t be
afraid to:

● Write a little bit of code and test it.

● Fix and and change it as needed.

● Repeat above or, if you like it, move on to the next part of your project.
Tips and Tricks

Save Often

● Save your project world often - every 10 -


20 minutes
● Alice worlds can be corrupted so use a
progressive naming convention for
incremental backups name.a3p, name2.a3p
● Later versions of Alice 3 will also have an
autosave function that will save incremental
backups in case of an issue

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy