From 31ee818f55e2104d8766af7c5cb93b5e2138b74e Mon Sep 17 00:00:00 2001 From: thiagoribb Date: Mon, 12 Apr 2021 18:46:06 -0300 Subject: [PATCH] preparando review --- index.html | 27 -------------- script.js | 97 ------------------------------------------------ styles/style.css | 89 -------------------------------------------- 3 files changed, 213 deletions(-) delete mode 100644 index.html delete mode 100644 script.js delete mode 100644 styles/style.css diff --git a/index.html b/index.html deleted file mode 100644 index e0e9bd1..0000000 --- a/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - PARROT CARD GAME - - - - - - - - - - -
-

PARROT CARD GAME

-
-
- -
- - - - \ No newline at end of file diff --git a/script.js b/script.js deleted file mode 100644 index 7bfdb83..0000000 --- a/script.js +++ /dev/null @@ -1,97 +0,0 @@ -let cardsnumber = parseInt(prompt("Qual o número de cartas? Número par de 4 a 14")); -let win = 0; -let total = 0; -let front; -let card; -let imgs = [ - "papagaio com gorro preto dançante", - "papagaio explodindo", - "papagaio mexicano", - "papagaio roqueiro", - "papagaio no barco", - "três papagaios dançantes", - "papagaio unicórnio" -] - -//embaralha array das imagens -imgs.sort(randomSort); -let arraycards = []; - -while (cardsnumber % 2 != 0 || cardsnumber > 14 || cardsnumber < 4) { - cardsnumber = parseInt(prompt("Qual o número de cartas? Somente número par entre 4 a 14")); -} - -for (let i = 0; i < cardsnumber / 2; i++) { - arraycards.push(`
  • papagaio da frente da carta - ${imgs[i]}
  • `); - - arraycards.push(`
  • papagaio da frente da carta - ${imgs[i]}
  • `); - arraycards.sort(randomSort); -} - -//embaralha -arraycards.sort(randomSort); - -for (let i = 0; i < arraycards.length; i++) { - let cards = document.querySelector("ul"); - console.log(cards); - console.log(arraycards[i]); - cards.innerHTML += `${arraycards[i]}`; -} - -function randomSort() { - return Math.random() - 0.5; -} - -let list = []; - -function turn(card) { - const front = card.children[0]; - front.classList.add('disappears'); - - const gif = card.children[1]; - console.log(gif); - - gif.classList.remove('disappears'); - gif.classList.add('appears'); - - list.push(gif); - total += 1 - - if (list.length == 2) { - - test(list[0], list[1]); - list = [] - } -} - -function test(card1, card2) { - if (card1.src === card2.src) { - card1.removeAttribute('onclick'); - win = win + 2; - console.log(win); - setTimeout(game, 1000); - // aguarda 1 segundo e então vira as duas cartas para baixo novamente - } else if (card1.src !== card2.src) { - setTimeout(untap, 1000, card1, card2); - } else { - setTimeout(untap, 1000, card1, card2); - } -} - -function game() { - if (win === cardsnumber) { - alert("você venceu em " + total + " jogadas"); - } -} - -function untap(card1, card2) { - console.log(card1.parentNode) - card1.parentNode.children[0].classList.remove('disappears'); - card1.parentNode.children[1].classList.remove('appears'); - card1.parentNode.children[1].classList.add('disappears'); - card2.parentNode.children[0].classList.remove('disappears'); - card2.parentNode.children[1].classList.remove('appears'); - card2.parentNode.children[1].classList.add('disappears'); -} \ No newline at end of file diff --git a/styles/style.css b/styles/style.css deleted file mode 100644 index 90fb21e..0000000 --- a/styles/style.css +++ /dev/null @@ -1,89 +0,0 @@ -* { - box-sizing: border-box; -} - -body { - background: #EEF9BF; - font-family: 'Roboto:wght@700', sans-serif; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -.boxcards { - display: flex; - justify-content: center; - width: 100%; - align-items: center; -} - -h1 { - - font-size: 56px; - font-style: normal; - font-weight: bold; - line-height: 66px; - letter-spacing: -0.004em; - color: #75B79E; - margin-top: 50px; - text-align: center; - margin-bottom: 47px; -} - -ul { - display: flex; - flex-wrap: wrap; - justify-content: center; - align-items: center; -} - -li { - - width: 117px; - height: 146px; - background: #A7E9AF; - border-radius: 5px; - position: relative; - margin: 0px 34px 34px 0px; - border: 1px solid #99CEA8; -} - -img { - width: 100px; - height: 100px; - position: absolute; - margin: auto; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.appears { - display: block; -} - -.disappears { - display: none; -} - -@media(max-width:600px) { - h1 { - font-size: 36px; - text-align: center; - margin-top: 37px; - margin-bottom: 27px; - } - - ul { - flex-wrap: nowrap; - flex-direction: column; - align-items: center; - - } - - li { - margin-right: 0px; - } -} \ No newline at end of file