fixed #21
This commit is contained in:
parent
530260ac54
commit
65b33afa05
2 changed files with 4 additions and 2 deletions
|
@ -168,7 +168,7 @@
|
||||||
popup.addContent({
|
popup.addContent({
|
||||||
"Time": snek.playTime/1000+'s',
|
"Time": snek.playTime/1000+'s',
|
||||||
"Score": snek.score,
|
"Score": snek.score,
|
||||||
"Final length": snek.snake.length
|
"Final length": snek.length
|
||||||
});
|
});
|
||||||
popup.buttons={
|
popup.buttons={
|
||||||
retry: "Retry",
|
retry: "Retry",
|
||||||
|
@ -206,7 +206,7 @@
|
||||||
popup.addContent({
|
popup.addContent({
|
||||||
"Time": snek.playTime/1000+'s',
|
"Time": snek.playTime/1000+'s',
|
||||||
"Score": snek.score,
|
"Score": snek.score,
|
||||||
"Final length": snek.snake.length
|
"Final length": snek.length
|
||||||
});
|
});
|
||||||
popup.buttons={
|
popup.buttons={
|
||||||
retry: "Retry",
|
retry: "Retry",
|
||||||
|
|
|
@ -102,6 +102,7 @@ class SnekGame {
|
||||||
|
|
||||||
// store the snake
|
// store the snake
|
||||||
this.snake=[...settings.snake];
|
this.snake=[...settings.snake];
|
||||||
|
this.length=this.snake.length;
|
||||||
|
|
||||||
// get our canvas, like, if we want to actually draw
|
// get our canvas, like, if we want to actually draw
|
||||||
this.canvas=canvas;
|
this.canvas=canvas;
|
||||||
|
@ -418,6 +419,7 @@ class SnekGame {
|
||||||
// re-grow the snake
|
// re-grow the snake
|
||||||
this.snake.push(tail);
|
this.snake.push(tail);
|
||||||
this.world[tail[0]][tail[1]]=SNAKE;
|
this.world[tail[0]][tail[1]]=SNAKE;
|
||||||
|
this.length++;
|
||||||
|
|
||||||
// remove the fruit from existence
|
// remove the fruit from existence
|
||||||
this.world[head[0]][head[1]]=SNAKE;
|
this.world[head[0]][head[1]]=SNAKE;
|
||||||
|
|
Loading…
Reference in a new issue