Browse Source

update

main
Justin Senn 2 years ago
parent
commit
86fc6a2578
  1. 8
      src/main/java/Snake/Snake.java

8
src/main/java/Snake/Snake.java

@ -82,6 +82,14 @@ public class Snake {
return bodySegments; return bodySegments;
} }
public void setDirection(SnakeDirection direction)
{
if((this.direction == SnakeDirection.LEFT && direction != SnakeDirection.RIGHT) ||
(this.direction == SnakeDirection.RIGHT && direction != SnakeDirection.LEFT) ||
(this.direction == SnakeDirection.UP && direction != SnakeDirection.DOWN) ||
(this.direction == SnakeDirection.DOWN && direction != SnakeDirection.UP))
this.direction = direction;
}

Loading…
Cancel
Save