Skip to content

Commit 1ef9cba

Browse files
committed
Fix snake position problem as described on #1
1 parent 357701a commit 1ef9cba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

snake.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class Snake {
1111

1212
buildTail() {
1313
// start in the middle of screen
14-
let middleOfScreenVertical = this.verticalSquares / 2;
15-
let middleOfScreenHorizontal = this.horizontalSquares / 2;
14+
let middleOfScreenVertical = Math.trunc(this.verticalSquares / 2);
15+
let middleOfScreenHorizontal = Math.trunc(this.horizontalSquares / 2);
1616

1717
for (let i=0; i<this.tail; i++) {
1818
this.trail.push({

0 commit comments

Comments
 (0)