Emm 2048 RESET

This commit is contained in:
2024-08-28 01:42:35 +02:00
parent f1e710de21
commit 0bfe2d76a8
6 changed files with 31 additions and 8 deletions

View File

@@ -9,9 +9,9 @@
<title>2048</title>
</head>
<body>
<h1>2048</h1>
<h2>Score: <span id="score">0</span></h2>
<h1>Score: <span id="score">0</span></h1>
<div id="board"></div>
<button id="reset" onclick="reset()"></button>
<a href="../" id="home"></a>
</body>
</html>

View File

@@ -1,7 +1,13 @@
var board;
const newBoard = [
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0],
];
var score = 0;
var rows = 4;
var columns = 4;
const rows = 4;
const columns = 4;
let startX, startY, endX, endY;
window.onload = function(){
@@ -216,4 +222,13 @@ function handleSwipe(){
document.getElementById("score").innerText = score;
}
}
}
async function reset(){
document.getElementById("board").innerHTML = '';
setGame();
score = 0;
document.querySelector('#score').innerText = '0';
/*board = newBoard;
setTwo();
setTwo();*/
}

View File

@@ -29,6 +29,17 @@ body{
background: #555;
}
#reset{
position: fixed;
left: 0;
bottom: 0;
height: 50px;
width: 50px;
border-radius: 0 25px 0 0;
background: #d55;
border: none;
}
#board{
width: 372px;
height: 372px;
@@ -36,7 +47,6 @@ body{
background: #cdc1d5;
border: 6px solid #bbada0;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}