I know how to make the background a random image but what if i want a random blank color from the start?
GreenfootImage pic = new GreenfootImage(600, 400); pic.setColor(new Color(Greenfoot.getRandomNumber(255 + 1), Greenfoot.getRandomNumber(255 + 1), Greenfoot.getRandomNumber(255 + 1))); pic.fill(); setBackground(pic);
ArrayList<Color> colors = new ArrayList<Color>(){{ add(Color.RED); add(Color.BLUE); add(Color.YELLOW); }}; GreenfootImage pic = new GreenfootImage(600, 400); pic.setColor(colors.get(Greenfoot.getRandomNumber(colors.size()))); pic.fill(); setBackground(pic);