Increase Performance
By FlyingRabidUnicornPig, with 1 reply.
Replied to by bourne, over 11 years ago:
Avoid garbage collection.
i.e.
Lots of calls to 'new' every act cycle, of large Objects.
For many of my scenarios, I use to create a new GreenfootImage every act cycle, draw on it, set as background, etc.
This image would be the size of the World, so it was large and a new one was created and thrown out every act cycle.
Solution: storing as instance variable and using clear() method before drawing