diff --git a/src/main/java/Snake/AppleView.java b/src/main/java/Snake/AppleView.java index 2f9d955..947e2e9 100644 --- a/src/main/java/Snake/AppleView.java +++ b/src/main/java/Snake/AppleView.java @@ -1,9 +1,9 @@ package Snake; -import java.awt.Graphics; -import java.awt.Point; +import java.awt.*; -public class AppleView implements Drawable{ +public class AppleView implements Drawable +{ private final Point position; private final int size; @@ -16,8 +16,15 @@ public class AppleView implements Drawable{ this.size = size; } - @Override - public void draw(Graphics g) { + public void setPosition(Point newPosition) + { + position.setLocation(newPosition); + } + @Override + public void draw(Graphics g) + { + g.setColor(Color.RED); + g.fillOval((int)position.getX()*size,(int)position.getY()*size, size, size); } }