You might want trying just to make a loop out of this so you only have one addObject line. Or, you might consider putting "new Bird()" in place of the "bird" (and therefore removing the line where you declare bird) since bird applies to only 1 of them.
first of all, you have to manually add the objects into your world class. We can't interactively add them when you export the scenario to Greenfoot Gallery.
Also, getRandomNumber generates a random integer between 0 (inclusive) and your number (exclusive).
so if we suppose that we have *random* assigned to the random number, you could make a loop that repeats *random* number of times and places an object into the world each time.
If your increment for getRandomNumber is small, it might get the same random number 2 times in a row, making it seem like you are using the same number as before. Making your source code available would be much better so I can see where your code needs editing.
Hope this helps!
Recent Comments | Show All
2008/12/27
animation tutorial results
2008/12/24
animation tutorial results