Zebra0.com

alice proceduresAlice Programming

Alice Programming

Learn Alice in FREE step-by-step lessons.

Module 14: Class Procedures in Alice3: Reusable Code

In this module, you will create procedures. Procedures let you write code for an object to perform an action.
For instance, you can write a procedure for a biped to wave. Then, whenever you want a character to wave, you just call the procedure.
The code can then be used many times and for many objects.
This will allow you to decompose a program into functional subprograms and create and test larger programs.
We will also use parameters so that we can tell the procedure how fast to wave, or how many times to wave. We can also use parameters to tell who the bunny faces when they wave.
This a very powerful tool and will let you greatly improve the efficiency of your code.

Goal:

In order to do this you will:

Objectives:

Print the lesson

Please study the material at each of the links below.

  1. Loki Waves Loki Waves: Video shows statements for making Loki wave.
    /alice/videos/alice-loki-waving.mp4

  2. A Biped Waving Procedure A Biped Waving Procedure: Copy the code for Loki waving to create procedure for any biped to wave.
    /alice/videos/alice-wave-procedure.mp4
  3. Adding Parameters to a Procedure Adding Parameters to a Procedure: Parameters are added so that we can vary the amount to wave and times to wave.
    /alice/videos/alice-parameters.mp4
  4. Witch casts spell Witch casts spell: Parameters let us cast the spell on anything to change it to anything else.
    /alice/videos/alice-witch-castspell.mp4
  5. Break the Spell Break the Spell: A Scene procedure is used to break the spell.
    /alice/videos/alice-breakspell.mp4
  6. Make the dog crazy: Several Parameters Make the dog crazy: Several Parameters: Several parameters are added to call the dog.
    /alice/videos/alice-come-dog.mp4
  7. Anyone can walk Anyone can walk: A procedure for a biped to walk can be used for any biped.
    /alice/videos/alice-walk-procedure.mp4
  8. Self Study Questions Self Study Questions: What have you learned?

  9. Discussion Questions Discussion Questions

Active Learning

Use procedures to create an exercise class.

GlossaryGlossary for procedures lesson
Full Glossary