diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..30d74bc Binary files /dev/null and b/.DS_Store differ diff --git a/script.js b/script.js index 84de7fd..0e32247 100644 --- a/script.js +++ b/script.js @@ -17,6 +17,8 @@ document.onkeydown = preventDefaultForScrollKeys; })(); + + const firebaseConfig = { apiKey: "AIzaSyDRDvlwalRpidbThvTEMK6FZVsDnK5FSOQ", authDomain: "snakeevolution-90ebd.firebaseapp.com", @@ -329,11 +331,16 @@ function update() { document.getElementById('evoBox').textContent = ''; } } + + function playSound(){ + new Audio('sounds/eating_sound.wav').play(); + } // Self collision if (snake.some(seg => seg.x === head.x && seg.y === head.y)) return gameOver(); snake.unshift(head); // Eat food if (head.x === food.x && head.y === food.y) { + playSound() score++; document.getElementById('score').textContent = score; food = randomEmptyTile(); diff --git a/sounds/eating_sound.wav b/sounds/eating_sound.wav new file mode 100644 index 0000000..bac3f4f Binary files /dev/null and b/sounds/eating_sound.wav differ diff --git a/style.css b/style.css index 18d043d..481e396 100644 --- a/style.css +++ b/style.css @@ -214,7 +214,10 @@ main { } .game-btn:active { - transform: scale(0.96); + transform: translateY(1px); + background-color: #2aa314; + box-shadow: none; + transition: all 0.1s ease; } .game-btn:disabled { @@ -282,6 +285,8 @@ footer { font-size: 1.06em; } + + @media (max-width:520px) { #game-area { min-width: unset; @@ -292,4 +297,5 @@ footer { max-width: 95vw; max-height: 89vw; } -} \ No newline at end of file +} +