/**
* Creates stars to be displayed on the background image.
* The parameter shows the number of stars on the background image.
*/
public void createStars(int number)
{
for(int i = 0; i < number; i++)
{
GreenfootImage background = getBackground();
int x = Greenfoot.getRandomNumber(0 - 500);
int y = Greenfoot.getRandomNumber(0 - 500);
GreenfootImage image = new GreenfootImage(width, height);
image.setColor(Color.WHITE);
image.fillOval(2, 2, width, height);
setImage(image);
addObject(new Star(), x, y);
}
}
I AM TRYING TO PAINT STARS ONTO THE BACKGROUND OF MY ASTEROIDS PROGRAM, BUT WHEN I COMPILE, THIS MESSAGE KEEPS POPPING UP WHILE HIGHLIGHTING "width" FROM THE "GreenfootImage image = new GreenfootImage (width, height); IN RED: "width is not public in greenfoot.World; cannot be accessed from outside the package". I NEED HELP!