O'Reilly logo

Alice 3 Cookbook by Vanesa S. Olsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with a local variable

In this recipe, we will declare a local variable with an initial value to define the number of units that a bird must advance. Then we will pass this variable as a parameter for the move procedure. The variable will allow us to use a descriptive name instead of a number as a parameter, and therefore it will be easier to understand the code.

Getting ready

Follow these steps to set a simple scene with four birds of different classes and a fence:

  1. Select File | New... in the main menu to start a new project. A dialog box will display the six predefined templates with their thumbnail previews in the Templates tab.
  2. Select GrassyProject.a3p as the desired template for the new project and click OK. Alice will display a grassy ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required