Skip to content

Commit

Permalink
improve game, changing background and more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MikixIT committed Oct 21, 2023
1 parent f35a628 commit 0024505
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
12 changes: 11 additions & 1 deletion game.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ const scoreHTML = document.querySelector("#score")
°Creare la schermata di gameover 🔴 ✅
°Serpente che esce fuori dal gioco crepa 💀 ✅
°Score fuori da canva 👾 ✅
°Serpente che quando collide su stesso crepa e non dovrebbe 💀 ✅
°Creare Classifica 🥇
°Tasto riprova dopo il Gameover 🔄
°Serpente che quando collide su stesso crepa e non dovrebbe 💀
Opzionali:
°Mobile version 📱
*/

Expand Down Expand Up @@ -58,9 +62,14 @@ let drawGame = () => {
drawSnake();
drawFruit();
drawScore();
console.log(speed)

checkFruitCollision();
setTimeout(drawGame, 1000/ speed);

if (score % 5 === 0 && score !== 0) {
speed += 3; // Aumenta la velocità
}
}

let isGameover = () => {
Expand Down Expand Up @@ -119,6 +128,7 @@ let drawSnake = () => {
snakeParts.shift();
}


}

let changeSnakePosition = () => {
Expand Down
15 changes: 12 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,34 @@
}
body{
font-family: 'Pixelify Sans', cursive;
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: rgba(0, 0, 0, 0.754);
background: rgb(0,0,0);
background: linear-gradient(90deg, rgba(0,0,0,1) 0%, rgba(98,98,98,1) 50%, rgba(0,0,0,1) 100%);
}

html, body {
height: 100%;
width: 100%;
overflow: hidden;
}
h1{
color: rgba(255, 255, 255, 0.331);
animation: rainbow 6.5s linear;
animation: rainbow 30.5s linear;
animation-iteration-count: infinite;
}
canvas{
margin-top: 5px;
box-shadow: 20px 10px 50px black;
}
#score{
animation: rainbow 6.5s linear;
animation: rainbow 30.5s linear;
animation-iteration-count: infinite;
font-size: 50px;
margin-top: 5px;
Expand Down

0 comments on commit 0024505

Please sign in to comment.