Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload Robotron project from Alura Classes #7

Open
wants to merge 1 commit into
base: projeto_inicial
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

body {
background: url(../img/fundo.jpg);
background: url(../img/apocalypse.jpg);
background-position: center center;
background-size: cover cover;
padding: 0;
Expand Down Expand Up @@ -38,19 +38,19 @@ main {
}

.robo {
height: 110%;
height: 115%;
z-index: 1;
position: absolute;
left: -20%;
left: -10%;
top: -5%;
}

.titulo {
transform: rotate(180deg);
font-weight: 500;
font-size: 130px;
font-size: 180px;
position: absolute;
bottom: 7rem;
bottom: 2rem;
left: -3rem;
line-height: 0.8;
writing-mode: vertical-rl;
Expand All @@ -61,7 +61,7 @@ main {
.box {
background: rgba(0,0,0,0.6);
clip-path: polygon(calc(100% - 30px) 0, 100% 30px, 100% calc(100% - 30px), calc(100% - 30px) 100%, 30px 100%, 0 calc(100% - 30px), 0 30px, 30px 0);
border-left: 5px solid var(--main-cinza);
border-left: 8px solid var(--main-cinza);
height: 80%;
}

Expand Down
Binary file added img/apocalypse.jpg
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 img/asas.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 img/blindagem.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 img/braco.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 img/foguete-cotovelo.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 img/foguete.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 img/nucleo.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 img/perna.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 img/raio.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 img/robotron (1).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 22 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,33 @@
<body>
<main>
<section class="robotron">
<img class="robo" src="img/robotron.png" alt="Robotron">
<img class="robo" src="img/robotron (1).png" alt="Robotron">
<figcaption class="titulo">ROBOTRON <br>2000</figcaption>
</section>

<section class="box estatisticas">
<div class="estatistica">
<p class="estatistica-titulo">Força</p>
<div class="estatistica-valor">
<p class="estatistica-numero">768</p>
<p class="estatistica-numero" data-estatistica="forca">534</p>
</div>
</div>
<div class="estatistica">
<p class="estatistica-titulo">Poder</p>
<div class="estatistica-valor">
<p class="estatistica-numero">630</p>
<p class="estatistica-numero" data-estatistica="poder">100</p>
</div>
</div>
<div class="estatistica">
<p class="estatistica-titulo">Energia</p>
<div class="estatistica-valor">
<p class="estatistica-numero">289</p>
<p class="estatistica-numero" data-estatistica="energia">150</p>
</div>
</div>
<div class="estatistica">
<p class="estatistica-titulo">Velocidade</p>
<div class="estatistica-valor">
<p class="estatistica-numero">597</p>
<p class="estatistica-numero" data-estatistica="velocidade">20</p>
</div>
</div>
</section>
Expand All @@ -52,51 +52,53 @@
<div class="peca">
<label for="" class="peca-titulo">Braços</label>
<div class="controle">
<buttom class="controle-ajuste">-</buttom>
<input type="text" class="controle-contador" value="00">
<buttom class="controle-ajuste">+</buttom>
<buttom class="controle-ajuste" data-controle="-" data-peca="bracos">-</buttom>
<input type="text" class="controle-contador" value="00" data-contador>
<buttom class="controle-ajuste" data-controle="+" data-peca="bracos">+</buttom>
</div>
</div>
<hr class="linha">
<div class="peca">
<label for="" class="peca-titulo">Blindagem</label>
<div class="controle">
<buttom class="controle-ajuste">-</buttom>
<input type="text" class="controle-contador" value="00">
<buttom class="controle-ajuste">+</buttom>
<buttom class="controle-ajuste" data-controle="-" data-peca="blindagem">-</buttom>
<input type="text" class="controle-contador" value="00" data-contador>
<buttom class="controle-ajuste" data-controle="+" data-peca="blindagem">+</buttom>
</div>
</div>
<hr class="linha">
<div class="peca">
<label for="" class="peca-titulo">Núcleos</label>
<div class="controle">
<buttom class="controle-ajuste">-</buttom>
<input type="text" class="controle-contador" value="00">
<buttom class="controle-ajuste">+</buttom>
<buttom class="controle-ajuste" data-controle="-" data-peca="nucleos">-</buttom>
<input type="text" class="controle-contador" value="00" data-contador>
<buttom class="controle-ajuste" data-controle="+" data-peca="nucleos">+</buttom>
</div>
</div>
<hr class="linha">
<div class="peca">
<label for="" class="peca-titulo">Pernas</label>
<div class="controle">
<buttom class="controle-ajuste">-</buttom>
<input type="text" class="controle-contador" value="00">
<buttom class="controle-ajuste">+</buttom>
<buttom class="controle-ajuste" data-controle="-" data-peca="pernas">-</buttom>
<input type="text" class="controle-contador" value="00" data-contador>
<buttom class="controle-ajuste" data-controle="+" data-peca="pernas">+</buttom>
</div>
</div>
<hr class="linha">
<div class="peca">
<label for="" class="peca-titulo">Foguetes</label>
<div class="controle">
<buttom class="controle-ajuste">-</buttom>
<input type="text" class="controle-contador" value="00">
<buttom class="controle-ajuste">+</buttom>
<buttom class="controle-ajuste" data-controle="-" data-peca="foguetes">-</buttom>
<input type="text" class="controle-contador" value="00" data-contador>
<buttom class="controle-ajuste" data-controle="+" data-peca="foguetes">+</buttom>
</div>
</div>
</div>
<input type="submit" value="Iniciar produção" class="producao" id="producao">
</form>
</section>
</main>

<script src="js/main.js"></script>
</body>
</html>
57 changes: 57 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const controle = document.querySelectorAll("[data-controle]")
const estatistica = document.querySelectorAll("[data-estatistica]")
const pecas = {
"bracos": {
"forca": 29,
"poder": 35,
"energia": -21,
"velocidade": -5
},

"blindagem": {
"forca": 41,
"poder": 20,
"energia": 0,
"velocidade": -20
},
"nucleos":{
"forca": 0,
"poder": 7,
"energia": 48,
"velocidade": -24
},
"pernas":{
"forca": 27,
"poder": 21,
"energia": -32,
"velocidade": 42
},
"foguetes":{
"forca": 0,
"poder": 28,
"energia": 0,
"velocidade": -2
}
}
controle.forEach( (elemento) =>{
elemento.addEventListener("click", (evento) =>{
manipulaDados(evento.target.dataset.controle, evento.target.parentNode)
atualizaEstatisticas(evento.target.dataset.peca)
})
})

function manipulaDados(operacao, controle) {
const peca = controle.querySelector("[data-contador]")

if(operacao === "-"){
peca.value = parseInt(peca.value) - 1
} else {
peca.value = parseInt(peca.value) + 1
}
}

function atualizaEstatisticas(peca){
estatisticas.forEach ((elemento) => {
elemento.textContent = parseInt(elemento.textContent) + pecas[peca][elemento.dataset.estatistica]
})
}