diff --git a/animations/click.js b/animations/click.js index 5efab84..b33c1d2 100644 --- a/animations/click.js +++ b/animations/click.js @@ -139,7 +139,7 @@ function particle(x, y) { this.yv = randInt(particlesMinSpeed, particlesMaxSpeed, false); this.size = randInt(particlesMinSize, particlesMaxSize, true); this.r = randInt(2, 36); - this.g = randInt(135, 150; + this.g = randInt(135, 150); this.b = randInt(190, 255); } @@ -159,4 +159,4 @@ function randInt(min, max, positive) { } -draw(); +drawClickAnimation(); diff --git a/minesweeper.js b/minesweeper.js index aaacac4..8c338e9 100644 --- a/minesweeper.js +++ b/minesweeper.js @@ -1,5 +1,7 @@ const canvas = document.getElementById('minesweeper-game'); const ctx = canvas.getContext('2d'); +const container = document.getElementById('game-container'); +const timeEl = document.getElementById('time'); const fieldSize = {x: 16, y: 12}; let tileSize; @@ -16,6 +18,9 @@ let zoomFactor = 1; let renderingConfig; +let startTime = 0; +let timer; + /** * Defines all possible colors for the tile numbers * @type {{ 1: string, 2: string, 3: string, 4: string, 6: string }} @@ -482,6 +487,7 @@ overlay2Canvas.addEventListener("click", (e) => { if (isFirstClick) { initBombs(pos.x, pos.y); + initTime(); isFirstClick = false; }