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 constants

In this task, we will use four local variables as constants. These constants are variables that won't change their value and provide a friendly name. These constants will define values for the units to advance in each step and the acceleration for slow and fast birds. It will be easy to understand the purpose of each of the constants because of their descriptive names.

Getting ready

We will use an existing project that makes birdBaby and bluebird run a race.

  1. Open the project saved in the Working with many local variables recipe.
  2. Click on Edit Code, at the lower-right corner of the big scene preview. Alice will show a smaller preview of the scene and will display the Code Editor on a panel located at the right-hand side of the ...

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