()
| 5 | let newSegments = 0 |
| 6 | |
| 7 | export function update() { |
| 8 | addSegments() |
| 9 | |
| 10 | const inputDirection = getInputDirection() |
| 11 | for (let i = snakeBody.length - 2; i >= 0; i--) { |
| 12 | snakeBody[i + 1] = { ...snakeBody[i] } |
| 13 | } |
| 14 | |
| 15 | snakeBody[0].x += inputDirection.x |
| 16 | snakeBody[0].y += inputDirection.y |
| 17 | } |
| 18 | |
| 19 | export function draw(gameBoard) { |
| 20 | snakeBody.forEach(segment => { |
nothing calls this directly
no test coverage detected