Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
jrugarte committed Apr 18, 2023
1 parent 70a246b commit e85139c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 28 deletions.
37 changes: 19 additions & 18 deletions assets/js/codigoff.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ let vidaJugador = 200;
let vidaEnemigo = 200;
let enemigoAleatorioName;
let enemigoAleatorio;
//primera vista de la pagina
let pJugador = document.createElement("p");
let pEnemigo = document.createElement("p");
//primera
function empezarJuego() {
// let sectionEncabezado = document.getElementById("encabezado");
// sectionEncabezado.style.display = "block";
Expand All @@ -20,12 +22,8 @@ function empezarJuego() {
sectionReinicio.style.display = "none";
let sectionSelectButton = document.getElementById("select-button");
sectionSelectButton.style.display = "flex";
let tuPv = document.getElementById("tu-pv");
tuPv.style.display = "none";
let pvEnemigo = document.getElementById("pv-enemigo");
pvEnemigo.style.display = "none";
let divPv = document.getElementById("pv");
divPv.style.display = "none";
pJugador.style.display = "none";
pEnemigo.style.display = "none";

let botonSelect = document.getElementById("Seleccionar");
botonSelect.addEventListener("click", SelectPlayer);
Expand Down Expand Up @@ -85,13 +83,15 @@ function SelectEnemy() {
sectionTextop.style.display = "flex";
let sectionSelectButton = document.getElementById("select-button");
sectionSelectButton.style.display = "none";
let tuPv = document.getElementById("tu-pv");
tuPv.style.display = "flex";
let divPv = document.getElementById("pv");
divPv.style.display = "flex";
let pvEnemigo = document.getElementById("pv-enemigo");
tuPv.innerHTML = vidaJugador;
pvEnemigo.innerHTML = vidaEnemigo;
// let Titulo = document.getElementsByClassName("title");
// Titulo.style.display = "flex";

pJugador.style.display = "flex";
pEnemigo.style.display = "flex";
pJugador.innerHTML = "Tu PV: " + vidaJugador;
pEnemigo.innerHTML = "PV Enemigo: " + vidaEnemigo;
sectionAtaques.appendChild(pJugador);
sectionAtaques.appendChild(pEnemigo);

let spanEnemigo = document.getElementById("personaje-enemigo");
enemigoAleatorio = aleatorio(1, 5);
Expand Down Expand Up @@ -143,6 +143,7 @@ function ataqueEnemigoAleatorio() {
ataqueEnemigo = "PARED";
}
combate();
// respuestaEnemigo.innerHTML = "El enemigo " + ataqueEnemigo;
}

function combate() {
Expand All @@ -156,7 +157,7 @@ function combate() {
if (ataqueEnemigo === "DISPARO") {
crearMensaje("Te espaldeó");
vidaJugador = vidaJugador - 50;
tuPv.innerHTML = vidaJugador;
pJugador.innerHTML = "Tu PV: " + vidaJugador;
}
} else if (ataqueJugador === "PARED") {
if (ataqueEnemigo === "ESCAPA") {
Expand All @@ -172,7 +173,7 @@ function combate() {
if (ataqueEnemigo === "ESCAPA") {
crearMensaje("Espaldeaste");
vidaEnemigo = vidaEnemigo - 50;
pvEnemigo.innerHTML = vidaEnemigo;
pEnemigo.innerHTML = "PV Enemigo: " + vidaEnemigo;
}
if (ataqueEnemigo === "PARED") {
crearMensaje("Zafó");
Expand All @@ -181,8 +182,8 @@ function combate() {
crearMensaje("Pelea de mancos");
vidaJugador = vidaJugador - 50;
vidaEnemigo = vidaEnemigo - 50;
tuPv.innerHTML = vidaJugador;
pvEnemigo.innerHTML = vidaEnemigo;
pJugador.innerHTML = "Tu PV: " + vidaJugador;
pEnemigo.innerHTML = "PV Enemigo: " + vidaEnemigo;
}
}
chequeoVidas();
Expand Down
11 changes: 1 addition & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ <h1 class="title">🔥 Fire-Free 🔥</h1>
</p>
<h2>Elige tu jugador:</h2>
</section>

<section class id="seleccionar-personaje">
<input type="radio" name="personaje" id="Jotaerre" />
<label class="select-jugador" for="Jotaerre">
Expand Down Expand Up @@ -47,11 +46,10 @@ <h2>Elige tu jugador:</h2>
<img src="./assets/images//alex.png" alt="L4F~Alex" />
</label>
</section>

<sectin id="select-button">
<button class="botones" id="Seleccionar">Seleccionar</button>
</section>

<section id="ataques">
<p id="personaje-select">
Seleccionaste a: <span id="personaje"> </span>
Expand All @@ -69,14 +67,7 @@ <h2>Elige tu jugador:</h2>
<button class="botones" id="tirar-pared">PONER PARED 🧊</button
><span id="pared"></span><br />
</div>
<div id="pv">

<p>"Tu PV: "<span id="tu-pv"></span></p><br />
<p>"PV Enemigo: "<span id="pv-enemigo"></span></p>

</div>
</section>

<section id="reiniciar-juego">
<button class="botones" id="reinicio">Reinicio</button>
</section>
Expand Down

1 comment on commit e85139c

@vercel
Copy link

@vercel vercel bot commented on e85139c Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

free-fire – ./

free-fire-jrugarte.vercel.app
free-fire-jr.vercel.app
free-fire-git-main-jrugarte.vercel.app

Please sign in to comment.