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

0
.gitignore vendored Normal file
View File

View File

@@ -1,3 +0,0 @@
{
"liveServer.settings.port": 5501
}

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;
}

View File

@@ -28,6 +28,7 @@ body{
pointer-events: none;
clip-path: polygon(48% 2%, 60% 18%, 77% 10%, 86% 14%, 91% 30%, 82% 36%, 73% 41%, 81% 51%, 90% 55%, 94% 63%, 95% 82%, 94% 86%, 81% 94%, 65% 90%, 55% 82%, 45% 85%, 25% 100%, 23% 100%, 5% 92%, 1% 82%, 0% 70%, 6% 68%, 14% 61%, 19% 60%, 25% 61%, 29% 53%, 23% 48%, 12% 48%, 6% 34%, 6% 20%, 8% 12%, 16% 5%, 22% 13%, 26% 18%, 30% 13%, 34% 6%, 40% 3%);
animation: rgb 5s linear infinite;
transition: .15s;
}
#blob::before{
content: '';