|
|
@ -15,6 +15,16 @@ public class SnakeView implements Drawable{ |
|
|
|
this.cellSize = cellSize; |
|
|
|
} |
|
|
|
|
|
|
|
public void setPositions(ArrayList<Point> newPositions) |
|
|
|
{ |
|
|
|
positions.clear(); |
|
|
|
for(var newPosition : newPositions) |
|
|
|
{ |
|
|
|
Point positionInGrid = newPosition; |
|
|
|
positions.add(new Point((int)positionInGrid.getX()*cellSize, |
|
|
|
(int)positionInGrid.getY()*cellSize)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void draw(Graphics g) { |
|
|
|