Skip to content
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
Binary file added images/alien.jpeg
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 images/human.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Challenge</title>
<!-- styles -->
<link rel="stylesheet" href="styles.css">
<!-- fonts -->
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@700&display=swap" rel="stylesheet">
</head>
<body>
<header class="header">
<h5 class="header-title">Platzi Game</h5>
<div class="header-circle"></div>
<div class="header-circle1"></div>
<div class="header-circle2"></div>
<div class="header-circle3"></div>
</header>
<article class="card">
<p class="card-title">Player 1</p>
<label class="card-percent" id="percent"></label>
<label class="card-hp" id="hp"></label>
<div class="card-buttonContainer">
<button class="card-button" id="play1">play</button>
</div>
<figure class="card-img">
<img src="images/alien.jpeg" alt="alien">
</figure>
</article>
<article class="card1">
<h6 class="card-title">Player 2</h6>
<label class="card-percent" id="percent1"></label>
<label class="card-hp" id="hp1"></label>
<div class="card-buttonContainer">
<button class="card-button" id="play2">play</button>
</div>
<figure class="card-img">
<img src="images/human.jpeg" alt="human">
</figure>
</article>
<footer class="footer">
<p class="owner">@MosqueraSt3</p>
<figure class="icon"><a href="https://github.com/MosqueraSt3" target="_blank"><img src="https://img.icons8.com/windows/32/000000/github.png"/></a></figure>
<figure class="icon1"><a href="https://www.instagram.com/mosquerast3/?hl=es-la" target="_blank"><img src="https://img.icons8.com/ios-filled/50/000000/instagram-new.png"/></a></figure>
</footer>


<script src="js.js"></script>
</body>
</html>
63 changes: 63 additions & 0 deletions js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
document.getElementById("play1").addEventListener("click", function(){

document.getElementById("play2").addEventListener("click", play2());

function play2() {
console.log("turno del jugador 2")
document.getElementById('play1').disabled = false;
document.getElementById('play2').disabled;
}

document.getElementById("play1").addEventListener("click", play2());

function play2() {
console.log("turno del jugador 1")
document.getElementById('play1').disabled;
document.getElementById('play2').disabled;
}
});








// document.getElementById("play1").addEventListener("click", function(){
// document.getElementById("play2").addEventListener("click", player2());
// document.getElementById('play1').disabled = true;
// document.getElementById('play2').disabled = false;
// var hp = 150;
// var hp2 = 150;
// do {
// if (document.getElementById('play1').disabled) {
// let damage = Math.floor(Math.random() * (50 - 1)) + 1;
// console.log(damage)
// var player2 = hp - damage;
// console.log(player2)
// let x = parseInt((player2 * 100)/hp);
// hp = player2;
// console.log(hp)
// document.getElementById("percent1").innerHTML = x+"%";
// document.getElementById('play1').disabled = false;
// document.getElementById('play2').disabled = true;
// console.log("true")
// } else if(){
// let damage = Math.floor(Math.random() * (50 - 1)) + 1;
// var player1 = hp2 - damage;
// let x = parseInt((player1 * 100)/hp);
// document.getElementById("percent1").innerHTML = x+"%";
// document.getElementById('play1').disabled = true;
// document.getElementById('play2').disabled = false;
// console.log("false")
// }
// } while (hp > 0 || hp2 > 0);





// });


186 changes: 186 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
body{
font-family: 'Poppins', sans-serif;
font-style: normal;
font-weight: bold;
font-size: 60px;
line-height: 90px;
}

header div{
background-color: #1A46E5;
border-radius: 100%;
}

.header-circle{
position: absolute;
width: 195px;
height: 195px;
left: -48px;
top: 26px;
}
.header-circle1{
position: absolute;
width: 97px;
height: 97px;
left: 162px;
top: 16px;
}
.header-circle2{
position: absolute;
width: 335px;
height: 335px;
left: 1004px;
top: -222px;
}
.header-circle3{
position: absolute;
width: 49px;
height: 49px;
left: 1314px;
top: 99px;
}
.header-title{
position: absolute;
width: 368px;
height: 90px;
left: 536px;
}
.card{
position: absolute;
width: 467px;
height: 582px;
left: 182px;
top: 269px;

background: #43D8C9;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 20px;
}
.card1{
position: absolute;
width: 467px;
height: 582px;
left: 791px;
top: 269px;

background: #FFBD11;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 20px;
}
.card-title{
position: absolute;
top: 30px;
height: 54px;
left: 165px;
font-size: 36px;
line-height: 54px;
color: #FFFFFF;
margin: 0px;
}
.card-percent{
position: absolute;
width: 66px;
height: 45px;
left: 135px;
top: 165px;
font-weight: bold;
font-size: 30px;
line-height: 45px;
color: #F7F7F7;
}
.card-hp{
position: absolute;
width: 215px;
height: 50px;
left: 60px;
top: 215px;

background: #1A46E5;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 30px;
}
.card-buttonContainer{
position: absolute;
width: 120px;
height: 120px;
left: 310px;
top: 160px;

background: #000000;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 100px;
}
.card-button{
position: absolute;
width: 120px;
height: 120px;
left: -6px;
top: -7px;
background: #1A46E5;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 100px;

font-style: normal;
font-weight: bold;
font-size: 36px;
line-height: 54px;
text-transform: capitalize;



color: #FFFFFF;
}
.card-img{
position: absolute;
width: 370px;
height: 231px;
left: 10px;
top: 250px;

background: #FFFFFF;
border: 3px solid #000000;
box-sizing: border-box;
border-radius: 20px;
text-align: center;
}
.card-img img{
width: 188px;
height: 200px;
left: 935px;
top: 588px;
margin: 20px;
}
.owner{
position: absolute;
width: 260px;
height: 36px;
left: 931px;
top: 880px;
font-size: 24px;
line-height: 36px;
}
.icon{
position: absolute;
width: 40px;
height: 40px;
left: 1110px;
top: 818px;
}
.icon img{
width: 50px;
height: 50px;
}
.icon1{
position: absolute;
width: 40px;
height: 40px;
left: 1160px;
top: 818px;
}