• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Social distancing? Try a better way to work remotely on your online files. Dokkio, a new product from PBworks, can help your team find, organize, and collaborate on your Drive, Gmail, Dropbox, Box, and Slack files. Sign up for free.


Alice - Sequencing and Composite Objects

Page history last edited by Steve Sweeney 10 years, 3 months ago

After creating a world using a background and various objects, it is possible to use Alice to animate the objects and create a scene.  In order to have a scene animate properly, it is necessary to make use of the following concepts:


  1. Objects

    The object is the most fundamental concept in Alice.  Everything in your world is made up of objects.  Each object in Alice comes from the local gallery or the web gallery.  The galleries contain the blueprints for each object, which in programming terminology are called classes.  For each object that you add to the world, you can access or control the following aspects:

    1. Properties

      These are the values that specify the object's characteristics, such as:

      1. colour
      2. opacity (the opposite of transparency)
      3. vehicle (if the object is riding around on another object)


    2. Methods

      Objects are able to perform actions, and the methods are the programming that specifies how those actions occur.  Each object in Alice comes with a number of "primitive" methods, and many objects will have identical methods (e.g., "move" or "say" or "turn to face").


    3. Composite Objects (objects within objects)

      Many classes define their objects as a combination of smaller objects.  A person, for example, might have separate objects for the head, arms, legs, and torso.  Each sub-object may also have methods associated with it, allowing for detailed control of some objects.  Be aware, however, that more objects to control can also increase the chance of making a mistake or getting unexpected results.


  2. Sequencing

    By default, any methods added to a world will be executed in order (i.e., from top to bottom, one at a time).  This sequencing is fine for simple scenes, but may not be adequate for more involved scenes.  Alice provides two (2) control statements to force blocks of code to use a particular sequencing.  These control statements are found at the bottom of the Alice window.

    1. Do together

      All statements included in the Do together block will be executed simultaneously (i.e., at the same time)


    2. Do in order

      All statements included in the Do in order block will occur one at a time, from top to bottom.  At first, this may seem unnecessary, since this is the default behaviour for Alice.  It becomes useful, however, when constructing nested statements.


    3. Nested Statements

      The Do together and Do in order blocks will normally contain two or more methods from the objects in a scene.  It is also possible to put either of these control statements into the block of another control statement, which produces a nested statement (i.e., the statements are nested within each other).



All new worlds are located in X:\Docs\Handout\Sweeney\Alice Worlds.

Save a copy of each world in your own folder, H:\00 ICS xx\Alice\Alice Worlds


Save at least one example from each exercise


  1. Open the world SpinningCubes (in the file SpinningCubes.a2w) and execute it.  Modify SpinningCubes so:
    1. the pause between the cubes spinning is one second.
    2. that both cubes turn to the right and cube2 turns only one revolution.
    3. that cube completes its turn in half a second and cube2 completes its turn in three seconds.
    4. each cube spins in both directions, first right then left.
    5. the cubes float up into the air 1 metre after they spin.
    6. cube makes a "pop" sound after it spins and cube2 makes a "thud" sound after it spins.
    7. the colour of cube2 changes to yellow after both cubes finish spinning.
    8. the size of cube shrinks by half and cube2 doubles in size when they finish spinning.
      1. have the sizes change as the cubes are spinning
    9. both cubes spin at the same time.
  2. Open the Blimps world. 
    1. Add a third blimp that moves half as fast as the others.
  3. Open the example world called Bugs and examine the code controlling the movement of the two ladybugs.
    1. Add a third Ladybug object that moves in its own pattern.
  4. Open the SurferWave world.  The surfer was created from the RandomGuy2 class in the People Gallery.  It is a composite object with many sub-objects (e.g., left leg, right leg, left arm, right arm, upper body).  These sub-objects, in turn, are made up of their own objects (e.g., left leg - knee - lower leg - foot).
    1. Examine the code of the world, paying particular attention to how individual parts of the surfer are controlled.

      Modify the SurferWave world so that:

    2. the surfer says, "Welcome to my world!" while he's waving.
    3. the surfer's arm returns to its original position after finishing the wave.
    4. the surfer moves his left hand to his hip during the wave.


Programming Tasks

  1. Create a world where a penguin waddles toward a hole in a frozen lake, tips over, and falls in.  The Penguin class can be found in the Animals gallery, and the FrozenLake class is in the Environments gallery.  Use the Circle class (coloured gray) from the Shapes gallery to make the hole.
  2. Create a world that shows a combination lock being dialed and then the latch opening.  The combination should have three numbers (e.g., 15-35-5, turning right, left, then right).  The CombinationLock class is in the Objects gallery.
  3. Create a world showing a fight between a troll and a wizard (see the Medieval gallery).  As the troll swings his club down to hit the wizard, the wizard points at the club and it goes flying out of the troll's hand.  Then the wizard casts a spell and sinks into the ground saying "Farewell" as he goes.


Comments (0)

You don't have permission to comment on this page.