This site requires JavaScript, please enable it in your browser!
Greenfoot back

programmer's Comments

Back to programmer's profile

that happens to me too, t3hwookie90
Level two is super, super, super hard ,is it impossible?, did anyone beat it?
1305, I am 1st!
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));
It is so hard, I only got to the spiky level, but still this game rocks, good job:)
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.
mjrb4, thank you for explaining! that was it.