-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update cards dinamic and project Mario Jump
- Loading branch information
1 parent
6a2f67d
commit 4b06353
Showing
11 changed files
with
255 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"liveServer.settings.port": 5501 | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
.game-board{ | ||
width: 100%; | ||
height: 500px; | ||
margin: 0 auto; | ||
border-bottom: 15px solid rgb(35, 160, 35); | ||
position: relative; | ||
overflow: hidden; | ||
background: linear-gradient(#87CEEB, #E0F6FF); | ||
} | ||
|
||
.player { | ||
width: 150px; | ||
position: absolute; | ||
bottom: 0; | ||
} | ||
|
||
.jump { | ||
animation: jump 500ms ease-out; | ||
} | ||
|
||
.clouds { | ||
position: absolute; | ||
width: 550px; | ||
animation: clouds-animation 20s infinite linear; | ||
} | ||
|
||
.pipe{ | ||
position: absolute; | ||
bottom: 0; | ||
width: 80px; | ||
animation: pipe-animation 1.5s infinite linear; | ||
} | ||
|
||
.scores-cards{ | ||
justify-content: center; | ||
display: flex; | ||
font-size: 2rem; | ||
} | ||
|
||
.score { | ||
text-transform: uppercase; | ||
letter-spacing: 0.1rem; | ||
} | ||
|
||
.score-number { | ||
margin-left: .5rem; | ||
} | ||
|
||
@keyframes pipe-animation { | ||
from { | ||
right: -80px; | ||
} | ||
|
||
to { | ||
right: 100%; | ||
} | ||
} | ||
|
||
@keyframes jump { | ||
0% { | ||
bottom: 0; | ||
} | ||
|
||
40%{ | ||
bottom: 180px; | ||
} | ||
|
||
50% { | ||
bottom: 180px; | ||
} | ||
|
||
60% { | ||
bottom: 180px; | ||
} | ||
|
||
100%{ | ||
bottom: 0; | ||
} | ||
} | ||
|
||
@keyframes clouds-animation { | ||
from { | ||
right: -150; | ||
} | ||
to { | ||
right: 100%; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Mario Jump</title> | ||
<link rel="stylesheet" href="./css/style.css"> | ||
</head> | ||
<body> | ||
<div class="game-board"> | ||
<img src="./images/clouds.png" alt="Imagem de nuvens" class="clouds"> | ||
<img src="./images/mario.gif" class="player" alt="player"> | ||
<img src="./images/pipe.png" class="pipe" alt="Imagem do tubo"> | ||
</div> | ||
<div class="scores-cards"> | ||
<div class="score">Score:</div> | ||
<div class="score-number">00</div> | ||
</div> | ||
<script src="./js/script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const mario = document.querySelector(".player"); | ||
const pipe = document.querySelector(".pipe"); | ||
let score = 0; | ||
const scoreNumberElement = document.querySelector('.score-number'); | ||
|
||
const jump = () => { | ||
mario.classList.add('jump'); | ||
setTimeout(() => { | ||
mario.classList.remove('jump'); | ||
},500); | ||
} | ||
|
||
const loop = setInterval(() => { | ||
const pipePosition = pipe.offsetLeft; | ||
const marioPosition = +window.getComputedStyle(mario).bottom.replace('px', ''); | ||
|
||
if(pipePosition <= 120 && pipePosition > 0 && marioPosition < 80){ | ||
pipe.style.animation = "none"; | ||
pipe.style.left = `${pipePosition}px`; | ||
|
||
mario.style.animation = "none"; | ||
mario.style.bottom = `${marioPosition}px`; | ||
|
||
mario.src = "./images/game-over.png"; | ||
mario.style.width = '75px'; | ||
mario.style.marginLeft = '50px'; | ||
clearInterval(loop); | ||
setTimeout(() => { | ||
window.location.reload(); | ||
}, 2000); | ||
} else if(pipePosition <= 120 && pipePosition > 0 && marioPosition >= 80){ | ||
score += 1; // Aumenta o score em 1 | ||
scoreNumberElement.textContent = score.toString().padStart(2, '0'); | ||
} | ||
|
||
},10) | ||
|
||
document.addEventListener("keydown", jump); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
const projects = [ | ||
{ | ||
title: "D&D", | ||
imgSrc: "./assets/img/DD.gif", | ||
link: "./assets/projects/DD/index.html", | ||
alt: "Projeto D&D" | ||
}, | ||
{ | ||
title: "Jogo da Cobrinha", | ||
imgSrc: "./assets/img/Snake.gif", | ||
link: "./assets/projects/JogoDaCobrinha/index.html", | ||
alt: "Projeto da Cobrinha" | ||
}, | ||
{ | ||
title: "Loteria", | ||
imgSrc: "./assets/img/Loteria.png", | ||
link: "./assets/projects/Loteria/index.html", | ||
alt: "Projeto Loteria" | ||
}, | ||
{ | ||
title: "Numero secreto", | ||
imgSrc: "./assets/img/Numero_secreto.png", | ||
link: "./assets/projects/Jogo-do-numero-secreto/index.html", | ||
alt: "Projeto Numero secreto" | ||
}, | ||
{ | ||
title: "Alura-Midi", | ||
imgSrc: "./assets/img/alura-midi.png", | ||
link: "./assets/projects/Alura-Midi/index.html", | ||
alt: "Projeto Alura-Midi" | ||
}, | ||
{ | ||
title: "Detona Ralph", | ||
imgSrc: "./assets/img/Detona_Ralph.png", | ||
link: "./assets/projects/Detona_Ralph/index.html", | ||
alt: "Projeto Detona Ralph" | ||
}, | ||
{ | ||
title: "Jogo da memoria", | ||
imgSrc: "./assets/img/memoria.png", | ||
link: "./assets/projects/Jogo_Da_Memoria/index.html", | ||
alt: "Projeto Jogo da memoria" | ||
}, | ||
{ | ||
title: "Jogo do numero secreto por voz", | ||
imgSrc: "./assets/img/Numero_voz.PNG", | ||
link: "https://numero-secreto-reconhecimento-voz-seven.vercel.app/", | ||
alt: "Projeto Jogo do numero secreto por voz" | ||
}, | ||
{ | ||
title: "Pokedex", | ||
imgSrc: "./assets/img/pokedex.gif", | ||
link: "./assets/projects/pokedex/index.html", | ||
alt: "Pokedex" | ||
}, | ||
{ | ||
title: "Yo-Gi-Oh", | ||
imgSrc: "./assets/img/Yo-Gi-Oh.gif", | ||
link: "./assets/projects/js-yugioh/index.html", | ||
alt: "Yo-Gi-Oh" | ||
}, | ||
{ | ||
title: "Teclado", | ||
imgSrc: "./assets/img/Teclado.gif", | ||
link: "./assets/projects/Teclado/index.html", | ||
alt: "Teclado" | ||
}, | ||
{ | ||
title: "Mario Jump", | ||
imgSrc: "./assets/img/marioJump.gif", | ||
link: "./assets/projects/superMario/index.html", | ||
alt: "Mario Jump" | ||
} | ||
]; | ||
|
||
// Função para criar e adicionar os cards ao DOM | ||
function createCards() { | ||
const container = document.getElementById('card-container'); | ||
|
||
projects.forEach(project => { | ||
const card = document.createElement('div'); | ||
card.className = 'card m-4'; | ||
card.style.width = '20rem'; | ||
|
||
card.innerHTML = ` | ||
<img src="${project.imgSrc}" class="card-img-top" alt="${project.alt}"> | ||
<div class="card-body"> | ||
<h5 class="card-title py-2 fw-bold">${project.title}</h5> | ||
<a href="${project.link}" class="btn botao-padrao w-100 fw-bold" aria-controls="offcanvasRight">Quero Jogar</a> | ||
</div> | ||
`; | ||
|
||
container.appendChild(card); | ||
}); | ||
} | ||
|
||
createCards(); |