From 5998df77819e33e1a712aa31251c477f29e350ff Mon Sep 17 00:00:00 2001 From: Justin Senn Date: Mon, 6 Feb 2023 17:38:57 +0100 Subject: [PATCH] update --- src/main/java/Snake/AppleView.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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); } }