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 up() { float coef = 2f; speed.add(new PVector(0,-1).mult(coef)); } public void down() { float coef = 2f; speed.add(new PVector(0,1).mult(coef)); } public void left() { float coef = 2f; speed.add(new PVector(-1,0).mult(coef)); } public void right() { float coef = 2f; speed.add(new PVector(1,0).mult(coef)); } }

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.