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...
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);
}
}
}
