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

Using arrays to control two instances

In this recipe, we will use an array to make the four birds cross the fence, one bird at a time. The array will act as a list of the birds that we must control within a loop. We will add code that runs for all the birds in the array.

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 main window.
  3. Click on the class: MyScene drop-down list and the list of classes that are part of the scene will appear.
  4. Select ...

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