This site requires JavaScript, please enable it in your browser!
Greenfoot back
DiplomatikCow
DiplomatikCow wrote ...

2015/1/10

Making your very own images?

DiplomatikCow DiplomatikCow

2015/1/10

#
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.
danpost danpost

2015/1/10

#
Simple, but there is more than meets the eye with this one:
setImage(new GreenfootImage(5 5));
getImage().fill();
danpost danpost

2015/1/10

#
For full impact of what is involved:
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
DiplomatikCow DiplomatikCow

2015/1/10

#
Thank you, for helping me with this and all my questions :D I will go use that
You need to login to post a reply.