|
@ -15,6 +15,16 @@ public class SnakeView implements Drawable{ |
|
|
this.cellSize = cellSize; |
|
|
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 |
|
|
@Override |
|
|
public void draw(Graphics g) { |
|
|
public void draw(Graphics g) { |
|
|