In my scenario BleetFleet I have some sun beams in the background that rotate around the sun. I've so far used two methods to achieve this.
Method 1) Paint the sky at construction. Then when running rotate large sun beam image and paint onto the sky, then paint the grass on top.
Pros: Less memory used
Cons: Slow, from 33fps to 12fps
Method 2) Create an array of GreenfootImages for frames(15 at the moment). Then draw the sky on each one, aswell as the sun beams rotated slightly each time. Then draw the grass on each one. This is done once at construction, then the images are looped through when running.
Pros: Fast. 30fps+ easily
Cons: Lots of memory needed. over 100MB I think. I kept on getting Java Heap space errors after a few compiles. Seems to have less memory problems exported.
Is there anyway to reduce the ammount of memory the images take up? Other than reducing the frame count. Or if anyone knows of a more efficient way of drawing the beams I would like to know.