RHE_THS and mjrb4,
Thank you both very much for explaining why the addObject lines were not working and how to fix it. This is a problem I had in several scenarios.
I'll change it into a loop.
The 700 was trying to debug, to see if it would solve the problem.
I'll go and fix the case problem too.
Thanks.
hi RHE_THS
thanks.
sorry. I meant to publish the code. The default is not-published. Now it is published.
Here is the code
public TestWorld()
{
// Create a new world with 20x20 cells with a cell size of 10x10 pixels.
super(800, 300, 1);
Bird bird = new Bird();
addObject(bird, Greenfoot.getRandomNumber(800), Greenfoot.getRandomNumber(400));
addObject(bird, Greenfoot.getRandomNumber(700), Greenfoot.getRandomNumber(400));
addObject(bird, Greenfoot.getRandomNumber(800), Greenfoot.getRandomNumber(400));
addObject(bird, Greenfoot.getRandomNumber(800), Greenfoot.getRandomNumber(400));
addObject(bird, Greenfoot.getRandomNumber(800), Greenfoot.getRandomNumber(400));
I am confused about how getRandomNumber works. I thought my code would add 5 objects, but it adds only one.
Why is that?
Also, it seems like getRandomNumber does not get a new number sometimes, but just uses the same number you got before.
2009/4/8
Christmas tree with blinking lights
2009/1/20
First attempt
2009/1/20
Cheese Hunt
2009/1/20
DragonBallZ
2008/12/29
animation tutorial results
2008/12/25
animation tutorial results
2008/12/24
MirrorPhase
2008/12/24
animation tutorial results
2008/12/24
Bombfield -- 3 player game, homework assignment