Snake (part 17)

  • 24
  • Locked
Now we'll finish the Snake class. The snake consists of pieces. Each turn, let's just add one piece at the head, and delete the last one. This will make the snake appear to slither. You need to add the piece next to the current head (index 0).
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Максим Василенко
Level 41 , Kiev, Ukraine
3 January, 06:35
Why do we have to add the last coordinates to the new ones when creating a new head?? I assume that we just need to set new coordinates without adding anything. SnakeSection head = sections.get(0); head = new SnakeSection(head.getX() + dx, head.getY() + dy);