Skip to content

Commit

Permalink
update cards dinamic and project Mario Jump
Browse files Browse the repository at this point in the history
  • Loading branch information
FelypeDantas committed Oct 25, 2024
1 parent 6a2f67d commit 4b06353
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 100 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
Binary file added assets/img/marioJump.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions assets/projects/superMario/css/style.css
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%;
}
}
Binary file added assets/projects/superMario/images/clouds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/projects/superMario/images/game-over.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/projects/superMario/images/mario.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/projects/superMario/images/pipe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions assets/projects/superMario/index.html
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>
38 changes: 38 additions & 0 deletions assets/projects/superMario/js/script.js
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);
102 changes: 2 additions & 100 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,107 +14,9 @@
<h1> Games Para se Divertir</h1>

<section class="py-5">
<div class="container d-flex justify-content-around flex-wrap">
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/DD.gif" class="card-img-top"
alt="Projeto D&D">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">D&D</h5>
<a href="./assets/projects/DD/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Snake.gif" class="card-img-top"
alt="Projeto da Cobrinha">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Jogo da Cobrinha</h5>
<a href="./assets/projects/JogoDaCobrinha/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Loteria.png" class="card-img-top"
alt="Projeto Loteria">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Loteria</h5>
<a href="./assets/projects/Loteria/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Numero_secreto.png" class="card-img-top"
alt="Projeto Numero secreto">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Numero secreto</h5>
<a href="./assets/projects/Jogo-do-numero-secreto/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/alura-midi.png" class="card-img-top"
alt="Projeto Alura-Midi">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Alura-Midi</h5>
<a href="./assets/projects/Alura-Midi/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Detona_Ralph.png" class="card-img-top"
alt="Projeto Detona Ralph">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Detona Ralph</h5>
<a href="./assets/projects/Detona_Ralph/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/memoria.png" class="card-img-top"
alt="Projeto Jogo da memoria">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Jogo da memoria</h5>
<a href="./assets/projects/Jogo_Da_Memoria/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Numero_voz.PNG" class="card-img-top"
alt="Projeto Jogo do numero secreto por voz">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Jogo do numero secreto por voz</h5>
<a href="https://numero-secreto-reconhecimento-voz-seven.vercel.app/" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/pokedex.gif" class="card-img-top"
alt="Pokedex">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Pokedex</h5>
<a href="./assets/projects/pokedex/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Yo-Gi-Oh.gif" class="card-img-top"
alt="Yo-Gi-Oh">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Yo-Gi-Oh</h5>
<a href="./assets/projects/js-yugioh/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="card m-4" style="width: 20rem;">
<img src="./assets/img/Teclado.gif" class="card-img-top"
alt="Teclado">
<div class="card-body">
<h5 class="card-title py-2 fw-bold">Teclado</h5>
<a href="./assets/projects/Teclado/index.html" class="btn botao-padrao w-100 fw-bold" href="#"
aria-controls="offcanvasRight">Quero Jogar</a>
</div>
</div>
<div class="container d-flex justify-content-around flex-wrap" id="card-container">
</div>
</section>
<script src="./script.js"></script>
</body>
</html>
97 changes: 97 additions & 0 deletions script.js
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();

0 comments on commit 4b06353

Please sign in to comment.