My create random and create stars methods are making my stars random colors? any ideas would be awesome! :)
private void createStars(int number)
{
GreenfootImage background = getBackground();
// this method creates the stars seen in the world
for(int i=0; i < number; i++) {
int x = Greenfoot.getRandomNumber( getWidth() );
int y = Greenfoot.getRandomNumber( getHeight() );
int color = 255;
background.fillOval(x, y, 2, 2);
background.setColorAt(x,y,new Color(color, color, color) );
}
}
private void createChallengeStars(int number)
{
GreenfootImage background = getBackground();
// this method creates the stars seen in the world, it also generates a random color for the stars
for(int i=0; i < number; i++)
{
int x = Greenfoot.getRandomNumber( getWidth() );
int y = Greenfoot.getRandomNumber( getHeight() );
int starSize = (Greenfoot.getRandomNumber(3)*2)+10;
background.setColor (new Color(Greenfoot.getRandomNumber(255 + 1), Greenfoot.getRandomNumber(255 + 1), Greenfoot.getRandomNumber(255 + 1)));
background.fillOval(x, y, starSize, starSize);
} //end for (int i= 0; i < number; i++)
}
private void createRandomStars(int number)
{
GreenfootImage background = getBackground();
// this method creates the stars seen in the world, it also generates a random color for the stars
for(int i=0; i < number; i++) {
int x = Greenfoot.getRandomNumber( getWidth() );
int y = Greenfoot.getRandomNumber( getHeight() );
int color = 255 - Greenfoot.getRandomNumber(230);
background.fillOval(x, y, 2, 2);
background.setColorAt(x,y,new Color(color, color, color));
}
}
