Browse Source

update

main
Justin Senn 2 years ago
parent
commit
b11bfe2e56
  1. 16
      src/main/java/Snake/Snake.java

16
src/main/java/Snake/Snake.java

@ -12,6 +12,22 @@ public class Snake {
private SnakeDirection direction; private SnakeDirection direction;
private final int gridSize;
public Snake(int gridSize)
{
this.gridSize = gridSize;
reset();
}
public void reset()
{
bodySegments.clear();
direction = SnakeDirection.UP;
Point headLocation = new Point(gridSize/2, gridSize/2);
bodySegments.add(headLocation);
bodySegments.add(new Point(gridSize/2, gridSize/2 + 1));
bodySegments.add(new Point(gridSize/2, gridSize/2 + 2));
}
} }
Loading…
Cancel
Save