PlayerPacman

public class PlayerPacman extends Pacman { private Ellipse2D circle; public PlayerPacman(float x, float y, float size) { super(x, y, size); } @Override public void setShapeAttributes() { super.setShapeAttributes(); circle = new Ellipse2D.Double(-dim.width/2, -dim.height/2, dim.width, dim.height); } @Override public void drawObject(Graphics2D g) { super.drawObject(g); AffineTransform at = g.getTransform(); g.translate(pos.x,pos.y); g.scale(size, size); g.setColor(Color.YELLOW); g.scale(2f, 2f); g.draw(circle); g.scale(1.5f, 1.5f); g.draw(circle); g.setTransform(at); } @Override protected void traceBestFood(ArrayList<SimulationObject> fList) { // do nothing } public void right() { speed.add(new PVector(-speed.y, speed.x).mult(.5f)); } public void left() { speed.add(new PVector(speed.y, -speed.x).mult(.5f)); } }

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.