Hello friends, I need help on my Garden project. This is the world class and it keeps saying error. I'm not so sure why...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) public class Garden extends World { public Garden() { with a cell size of 1x1 pixels. super ( 800 , 600 , 1 ); buildWildFlowers( 20 ); } public int getRandomX() { return Greenfoot.getRandomNumber(getWidth()); } public int getRandomY() { return Greenfoot.getRandomNumber(getHeight()); } public void buildWildFlowers( int amount) { for ( int i = 0 ; i < amount; i++) { int flowerType = Greenfoot.getRandomNumber( 4 ); // 0 to 3 Flower flower = new Flower(flowerType); getRandomX() and getRandomY() from Flower instead of Garden int x = flower.getRandomX(); int y = flower.getRandomY(); addObject(flower, x, y); } } } |