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.
We will use an existing project that makes
bluebird run a race.
- Open the project saved in the Working with many local variables recipe.
- 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.
- Click on the class: MyScene drop-down list and the list of classes that are part of the scene will appear.
- Select ...