[GREENFOOT-180] an overridable draw or paint method for the Actor class
Move the draw method to the Actor class have it perform the same it is now. Like: {noformat} public class Actor() { protected void draw(java.awt.Graphics g) { java.awt.BufferedImage img = getAwtImage(); g.drawImage(img, getX()-img.getWidth()/2, getY()-img.getHeight()/2, null); } } {noformat} Drawing some things in Greenfoot using the Actors setImage and getImage methods can be expensive if it requires a large image or can be more cumbersome then using non-image drawing routines. By adding this overridable method you can then add your own custom drawing code for when the Actor is drawn. For example drawing a very long line to the screen requires a large image, or drawing a changing shape for the Actor requires drawing the polygon to the actors image each time it acts. In both cases bypassing the Actors image would be more efficient.
Issue metadata
- Issue type: Task
- Priority: Low
- Fix versions: 2.0