Browse Source

update

main
Justin Senn 2 years ago
parent
commit
5998df7781
  1. 17
      src/main/java/Snake/AppleView.java

17
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);
}
}
Loading…
Cancel
Save