Beruflich Dokumente
Kultur Dokumente
Browse to the Greenfoot directory and open “scenarios”, and select “wombats”.
These two poor bears are too hungry; let’s give them more leaves by right-clicking the tool bar
near the "wombatWorld" label. Select "Void randomLeaves(int howMany)" from the drop-down
list.
An window would pop up and ask how many random leaves to add. Enter “10” and click “OK”.
Ten leaves would be added randomly.
We are ready to run the program now. To run the program step by step, click “Act”. To run the
program continuously, click “Run”.
You can view the Scenario Information by clicking the highlighted button.
Next, we can change the Actor’s image. Right click on the Wombat button and select “Set
image” from the drop-down menu.
Select an image you like. I selected the Linux Penguin named “tux.png”. Click OK to save.
Also change the Leave’s image. I changed it to the image of a strawberry.
When done, click “Compile all” button to recompile the program. To compile a program just
means to build a program executable.
To run the modified program, we will repopulate the world and restart the program. To populate
the world, right click wombatWorld title above the program view and select “void populate()”
from the drop down list. Then click the “Run” button to run the program. Also, you can add
more strawberries by selecting the “void randomLeaves(int howMany)” from the drop-down list.