I want to be able to just generate an image at will instead of having to set an image from one stored in the file. What code would be required to generate...lets say, a 5x5 black square. I know it's simple, but I would like to know.


setImage(new GreenfootImage(5 5)); getImage().fill();
GreenfootImage image; // declare local variable to hold image created image = new GreenfootImage(5, 5); // assign new image to variable image.setColor(java.awt.Color.black); // set the drawing color of the image to black image.fill(); // fill the image with the drawing color setImage(image); // set the image to the actor