您的位置 首页 > 收藏资讯

陶瓷拼图游戏:瓷器连连看

陶瓷拼图游戏:瓷器连连看

.
.
.card-
.card-
.card-
.连连看-
.连连看-controls
.连连看-controls button:
.
.result
.result-
.result-
.
.
.loading .
.loading .spinner .
@keyframes spin {


}
陶瓷拼图游戏:瓷器连连看
待加载完成
0分
0胜
0平
0负
1
2
3
4
const loading = document.getElementById("loading");
const result = document.getElementById("result");
const resultLoading = document.getElementById("result-loading");
const controls = document.getElementById("controls");
let score = 0;
let isGameOver = false;
const cards = document.querySelectorAll(".card");
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function drawCards() {
const shuffledCards = shuffle(cards);
loading.classList.remove("loading");
result.classList.remove("loading");
resultLoading.classList.remove("loading");
const card1 = document.getElementById("card-1");
card1.textContent = shuffledCards[0];
card1.classList.remove("controls-button");
const card2 = document.getElementById("card-2");
card2.textContent = shuffledCards[1];
card2.classList.remove("controls-button");
const card3 = document.getElementById("card-3");
card3.textContent = shuffledCards[2];
card3.classList.remove("controls-button");
const card4 = document.getElementById("card-4");
card4.textContent = shuffledCards[3];
card4.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
controls.classList.remove("loading");
document.querySelectorAll("button").forEach((button) => {
button.addEventListener("click", () => {
if (!isGameOver) {
const cardIndex = Math.floor(Math.random() * shuffledCards.length);
const card = shuffledCards[cardIndex];
controls.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
});
});
}
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const load = () => {
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
button.removeEventListener("click", () => {
if (!isGameOver) {
const cardIndex = Math.floor(Math.random() * shuffledCards.length);
const card = shuffledCards[cardIndex];
controls.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
});
});
loading.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "完成";
controls.classList.remove("loading");
};
const start = () => {
const loading = document.getElementById("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
const loading = document.getElementById("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
button.addEventListener("click", () => {
if (!isGameOver) {
const cardIndex = Math.floor(Math.random() * shuffledCards.length);
const card = shuffledCards[cardIndex];
controls.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
});
});
}
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const loadMore = () => {
if (isGameOver) {
return;
}
loading.classList.remove("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
if (event.type === "button") {
if (event.target.matches(".controls-button")) {
if (isGameOver) {
return;
}
const button = event.target;
if (button.textContent === "") {
return;
}
controls.classList.remove("loading");
if (event.type === "card") {
result.classList.remove("loading");
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
}
}
});
const start = () => {
const loading = document.getElementById("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
button.addEventListener("click", () => {
if (!isGameOver) {
const cardIndex = Math.floor(Math.random() * shuffledCards.length);
const card = shuffledCards[cardIndex];
controls.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
});
});
}
function shuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const loadMore = () => {
if (isGameOver) {
return;
}
loading.classList.remove("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
if (event.type === "button") {
if (event.target.matches(".controls-button")) {
if (isGameOver) {
return;
}
const button = event.target;
if (button.textContent === "") {
return;
}
controls.classList.remove("loading");
if (event.type === "card") {
result.classList.remove("loading");
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true;
}
}
}
}
});
const start = () => {
const loading = document.getElementById("loading");
const loadingCards = document.querySelectorAll(".card");
for (let i = 0; i {
button.addEventListener("click", () => {
if (!isGameOver) {
const cardIndex = Math.floor(Math.random() * shuffledCards.length);
const card = shuffledCards[cardIndex];
controls.classList.remove("loading");
result.classList.remove("loading");
resultLoading.textContent = "正在加载中...";
const resultScore = Math.random()
.multiply(2)
.toFixed(2);
score += resultScore;
const gameOver = Math.random() = 0.5 ? "胜" : "负"}`;
} else {
controls.classList.remove("controls-button");
result.classList.remove("loading");
resultLoading.textContent = ${resultScore}分${Math.random() >= 0.5 ? "胜" : "负"};
isGameOver = true

本站涵盖的内容、图片、视频等数据,部分未能与原作者取得联系。若涉及版权问题,请及时通知我们并提供相关证明材料,我们将及时予以删除!谢谢大家的理解与支持!

Copyright © 2023