-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4157 from Parth20GitHub/detona
new game added
- Loading branch information
Showing
13 changed files
with
235 additions
and
0 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,63 @@ | ||
<!DOCTYPE html> | ||
<html lang="pt-br"> | ||
|
||
<head> | ||
|
||
<!-- settings --> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Detona Ralph</title> | ||
|
||
<!-- fonts --> | ||
<link rel="preconnect" href="https://fonts.googleapis.com"> | ||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Press+Start+2P&display=swap" rel="stylesheet"> | ||
|
||
<!-- styles --> | ||
<link rel="stylesheet" href="./src/styles/reset.css"> | ||
<link rel="stylesheet" href="./src/styles/main.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div class="container"> | ||
<div class="menu"> | ||
<div class="menu-time"> | ||
<h2 style="color: red;">Time Left</h2> | ||
<h2 id="time-left">0</h2> | ||
</div> | ||
<div class="menu-score"> | ||
<h2 style="color: red;">Your Score</h2> | ||
<h2 id="score">0</h2> | ||
</div> | ||
<div class="menu-lives"> | ||
<img src="./src/images/player.png" alt="foto do jogador" height="60px" /> | ||
<h2>x3</h2> | ||
</div> | ||
</div> | ||
|
||
<div class="panel"> | ||
<div class="panel-row"> | ||
<div class="square " id="1"></div> | ||
<div class="square" id="2"></div> | ||
<div class="square" id="3"></div> | ||
</div> | ||
|
||
<div class="panel-row"> | ||
<div class="square enemy" id="4"></div> | ||
<div class="square" id="5"></div> | ||
<div class="square" id="6"></div> | ||
</div> | ||
|
||
<div class="panel-row"> | ||
<div class="square" id="7"></div> | ||
<div class="square" id="8"></div> | ||
<div class="square" id="9"></div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<script defer src="./src/scripts/engine.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,49 @@ | ||
## Awesome JSGame Detona Ralph | ||
|
||
``` | ||
#game-development | ||
#javascript-game | ||
#html-css-javascript | ||
#html-css-javascript-games | ||
#ifood | ||
#dio-bootcamp | ||
``` | ||
|
||
|
||
# Bem-vindo ao **JSGame Detona Ralph**! | ||
|
||
Um projeto que, além do entretenimento, demonstra várias técnicas avançadas de desenvolvimento de jogos em JavaScript. | ||
|
||
|
||
Aqui, no repositório, você encontrará os arquivos do projeto. | ||
|
||
Nesta [página do jogo](https://netopaiva.github.io/detona-ralph/) você poderá se divertir com um *game* baseado no famoso filme "Detona Ralph". | ||
|
||
### Tecnologias Utilizadas | ||
|
||
- HTML5 e CSS3 para a estrutura e aparência do jogo. | ||
- JavaScript para a lógica de programação e interatividade. | ||
- Sprites e imagens customizadas para criar a estética única do universo de Detona Ralph. | ||
|
||
### Funcionalidades Incríveis | ||
|
||
- **Sistema de Pontuação**: Acompanhe sua pontuação à medida que progride no jogo e desafie seus amigos a superá-la, clique no quadrado que o Ralph se encontre | ||
|
||
### Como Jogar | ||
|
||
1. Clone este repositório para sua máquina local. | ||
2. Abra o arquivo `index.html` em seu navegador web. | ||
3. Use as setas direcionais para mover o personagem e a barra de espaço para interagir. | ||
4. Divirta-se explorando e coletando moedas, mas fique atento aos inimigos! | ||
|
||
### Contribuição | ||
|
||
Contribuições são bem-vindas! Se você deseja melhorar este jogo, adicionar novos recursos ou corrigir problemas, sinta-se à vontade para abrir um _pull request_. | ||
|
||
### Créditos | ||
|
||
Este jogo foi desenvolvido como parte de um projeto educacional da Digital Innovation One. | ||
|
||
--- | ||
|
||
Divirta-se [jogando o **JSGame Detona Ralph**](https://netopaiva.github.io/detona-ralph/) enquanto explora as técnicas modernas de desenvolvimento de jogos em JavaScript. Lembre-se de conferir o repositório original [aqui](https://github.com/digitalinnovationone/jsgame-detona-ralph) e deixar uma ⭐️ se você gostou do projeto! |
Binary file not shown.
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,65 @@ | ||
const state = { | ||
view: { | ||
squares: document.querySelectorAll(".square"), | ||
enemy: document.querySelector(".enemy"), | ||
timeLeft: document.querySelector("#time-left"), | ||
score: document.querySelector("#score"), | ||
}, | ||
values: { | ||
gameVelocity: 1000, | ||
hitPosition: 0, | ||
result: 0, | ||
curretTime: 60, | ||
}, | ||
actions: { | ||
timerId: setInterval(randomSquare, 1000), | ||
countDownTimerId: setInterval(countDown, 1000), | ||
}, | ||
}; | ||
|
||
function countDown() { | ||
state.values.curretTime--; | ||
state.view.timeLeft.textContent = state.values.curretTime; | ||
|
||
if (state.values.curretTime <= 0) { | ||
clearInterval(state.actions.countDownTimerId); | ||
clearInterval(state.actions.timerId); | ||
alert("Game Over! O seu resultado foi: " + state.values.result); | ||
} | ||
} | ||
|
||
function playSound(audioName) { | ||
let audio = new Audio(`./src/audios/${audioName}.m4a`); | ||
audio.volume = 0.2; | ||
audio.play(); | ||
} | ||
|
||
function randomSquare() { | ||
state.view.squares.forEach((square) => { | ||
square.classList.remove("enemy"); | ||
}); | ||
|
||
let randomNumber = Math.floor(Math.random() * 9); | ||
let randomSquare = state.view.squares[randomNumber]; | ||
randomSquare.classList.add("enemy"); | ||
state.values.hitPosition = randomSquare.id; | ||
} | ||
|
||
function addListenerHitBox() { | ||
state.view.squares.forEach((square) => { | ||
square.addEventListener("mousedown", () => { | ||
if (square.id === state.values.hitPosition) { | ||
state.values.result++; | ||
state.view.score.textContent = state.values.result; | ||
state.values.hitPosition = null; | ||
playSound("hit"); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
function initialize() { | ||
addListenerHitBox(); | ||
} | ||
|
||
initialize(); |
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,48 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
background-image: url("../images/wall.png"); | ||
} | ||
|
||
.menu { | ||
display: flex; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
|
||
height: 90px; | ||
width: 100%; | ||
background-color: #000000; | ||
color: #ffffff; | ||
border-bottom: 5px solid #ffd700; | ||
} | ||
|
||
.panel { | ||
margin-top: 1rem; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.square { | ||
height: 150px; | ||
width: 150px; | ||
border: 1px solid #000000; | ||
background-color: #1aeaa5; | ||
} | ||
|
||
.enemy { | ||
background-image: url("../images/ralph.png"); | ||
background-size: cover; | ||
} | ||
|
||
.menu-lives { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.menu-time h2:nth-child(2), | ||
.menu-score h2:nth-child(2) { | ||
margin-top: 1rem; | ||
} |
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,7 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
/* font-family: "Bebas Neue", sans-serif; */ | ||
font-family: "Press Start 2P", cursive; | ||
} |
Submodule detona-ralph
added at
ad4688
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.