Fix reset of game
This commit is contained in:
@@ -5,7 +5,7 @@ const fieldSize = {x: 12, y: 20};
|
|||||||
|
|
||||||
let isPaused = true;
|
let isPaused = true;
|
||||||
|
|
||||||
function clearArena() {
|
function clearScreen() {
|
||||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ const colors = [
|
|||||||
'#3877FF',
|
'#3877FF',
|
||||||
];
|
];
|
||||||
|
|
||||||
const arena = createMatrix(fieldSize.x, fieldSize.y);
|
let arena = createMatrix(fieldSize.x, fieldSize.y);
|
||||||
|
|
||||||
const player = {
|
const player = {
|
||||||
pos: {x: 0, y: 0},
|
pos: {x: 0, y: 0},
|
||||||
@@ -270,6 +270,7 @@ document.addEventListener('keydown', event => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function startGame() {
|
function startGame() {
|
||||||
|
arena = createMatrix(fieldSize.x, fieldSize.y)
|
||||||
playerReset();
|
playerReset();
|
||||||
update();
|
update();
|
||||||
updateScore();
|
updateScore();
|
||||||
|
Reference in New Issue
Block a user