SmartPacwoman (1)

public class SmartPacwoman extends Pacwoman{ private Image badge; public SmartPacwoman(float x, float y, float size) { super(x, y, size); } @Override protected void setShapeAttributes() { super.setShapeAttributes(); try { badge = ImageIO.read(new File("asset/starbadge.png")); } catch (IOException e) { } } @Override public void draw(Graphics2D g) { super.draw(g); AffineTransform at = g.getTransform(); g.translate(pos.x, pos.y); g.rotate(speed.heading()); g.scale(scale, scale); if (speed.x < 0) g.scale(1, -1); //draw badge g.drawImage(badge, dimension.width/20, 0, dimension.height/3, dimension.height/3, null); g.setTransform(at); } }
Extends Pacwoman and override Draw()

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.