diff --git a/css/characters.css b/css/characters.css new file mode 100644 index 0000000..2c0eeba --- /dev/null +++ b/css/characters.css @@ -0,0 +1,266 @@ +/*Dibujo de personaje*/ +/*Rostro*/ +.face { + position: absolute; + right: auto; + left: 27%; + background-color: #f3bf99; + height: 110px; + width: 85px; + border-radius: 40%; + z-index: 3; +} +.nose { + position: absolute; + right: auto; + margin-top: 2.5%; + left: 28.9%; + background-color: #ba1e31; + height: 30px; + width: 15px; + border-radius: 40%; + z-index: 3; +} +.beard { + position: absolute; + right: auto; + margin-top: 4%; + left: 27.5%; + background-color: #e9583f; + height: 100px; + width: 50px; + border-radius: 38%; + z-index: 3; +} +.mouth { + position: absolute; + right: auto; + margin-top: 5.5%; + left: 28%; + background-color: #f3bf99; + height: 30px; + width: 30px; + border-radius: 50%; + z-index: 3; +} +.smile { + position: absolute; + right: auto; + margin-top: 6%; + left: 29%; + height: 4px; + width: 15px; + border-bottom: 5px solid black; + transform: rotate(-45deg); + z-index: 3; +} +.eyes-content { + display: flex; + left: 27%; + position: absolute; + width: 50px; + justify-content: space-between; + height: 20px; + margin-top: 33px; + margin-left: 4px; +} +.eyebow { + right: auto; + left: 5px; + background-color: #e9583f; + height: 10px; + width: 20px; + border-radius: 40%; + z-index: 3; +} +.eyes { + margin-top: 5px; + margin-left: -32px; + background-color: black; + height: 10px; + width: 10px; + border-radius: 50%; + z-index: 3; +} +.hair { + background: radial-gradient( + 90px 90px at 50% 16%, + #e9583f 50%, + transparent 50% + ); + width: 15%; + height: 40%; + left: 25%; + position: absolute; + z-index: 2; +} +.circles { + background: radial-gradient(30px 30px at 40% 5%, #e9583f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 13%, #e9583f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 21%, #e9583f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 29%, #e9583f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 35%, #e9583f 50%, transparent 50%), + radial-gradient(25px 12px at 40% 41%, black 50%, transparent 50%); + background-repeat: no-repeat; + width: 200px; + height: 45%; + margin-top: 0%; + left: 27%; + position: absolute; + z-index: 3; +} +.circles2 { + background: radial-gradient(30px 30px at 40% 5%, #e62e3f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 13%, #e62e3f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 21%, #e62e3f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 29%, #e62e3f 50%, transparent 50%), + radial-gradient(30px 30px at 40% 35%, #e62e3f 50%, transparent 50%), + radial-gradient(25px 12px at 40% 41%, #e62e3f 50%, transparent 50%); + background-repeat: no-repeat; + width: 200px; + height: 45%; + margin-top: 0.5%; + left: 21%; + position: absolute; + z-index: 2; +} +.hair5 { + background-color: #e9583f; + position: absolute; + right: auto; + margin-top: 10.5%; + left: 32.3%; + z-index: 1; + height: 35px; + width: 25px; + border-radius: 30%; +} +/*Cuerpo*/ +.body-character { + position: absolute; + right: auto; + margin-top: 2%; + left: 29%; + background-color: #038691; + height: 150px; + width: 125px; + border-radius: 40%; + z-index: 1; +} + +.arm { + position: absolute; + right: auto; + margin-top: 2%; + left: 36%; + background-color: #f3bf99; + height: 150px; + width: 70px; + border-radius: 25px; + z-index: 2; +} +.arm-right { + margin-top: 10%; + margin-left: 15%; + z-index: 0; +} +.arm2 { + position: absolute; + right: auto; + background-color: #e9917d; + margin-left: 3.5%; + height: 70px; + width: 50px; + border-radius: 25px; +} + +.arm3 { + position: absolute; + right: auto; + margin-top: 4%; + background-color: #e9917d; + height: 70px; + width: 90px; + border-radius: 25px; +} +.leg { + position: absolute; + right: auto; + margin-top: 9.5%; + left: 34%; + background-color: #038691; + height: 50px; + width: 25px; + border-radius: 40%; + z-index: 0; +} + +.leg2 { + position: absolute; + right: auto; + margin-top: 9.5%; + left: 30%; + background-color: #038691; + height: 50px; + width: 25px; + border-radius: 40%; + z-index: 0; +} + +.sword { + position: absolute; + right: auto; + margin-top: -1%; + left: 35%; + background-color: #011c28; + height: 30px; + width: 50px; + border-radius: 0px; + z-index: 1; +} + +.sword1 { + position: absolute; + right: auto; + margin-top: -1.8%; + left: 35%; + background-color: #a6d1e5; + height: 20px; + width: 40px; + border-radius: 0px; + z-index: 0; +} + +.sword2 { + position: absolute; + right: auto; + margin-top: -2.5%; + left: 34.4%; + background-color: #31586b; + height: 10px; + width: 60px; + border-radius: 10px; + z-index: 0; +} +.sword3 { + position: absolute; + right: auto; + margin-top: -3.5%; + left: 36%; + background-color: #011c28; + height: 14px; + width: 15px; + border-radius: 0px; + z-index: 1; +} +.sword4 { + position: absolute; + right: auto; + margin-top: -4.8%; + left: 35.7%; + background-color: #31586b; + height: 20px; + width: 20px; + border-radius: 10px; + z-index: 1; +} diff --git a/css/styles.css b/css/styles.css new file mode 100644 index 0000000..b70ee55 --- /dev/null +++ b/css/styles.css @@ -0,0 +1,168 @@ +/* General */ +* { + margin: 0; + padding: 0; +} + +h1 { + text-align: center; +} +h3 { + padding-top: 15px; +} +/* Estilos tipográficos */ + +/* Header */ +.header { + width: 100%; + height: 120px; + display: flex; + justify-content: center; + align-items: center; +} +/* Body */ +body { + font-family: "Poppins", sans-serif; + margin: 0; +} +.container { + max-width: 1000px; + flex: 1; + margin: 0 auto; + display: flex; + justify-content: space-around; +} +.content-draw { + padding: 5%; +} +.player1 { + color: white; + border: 1px solid black; + border-radius: 10px; + width: 40%; + height: 500px; + background-color: #43d8c9; + text-align: center; +} +.player2 { + color: white; + border: 1px solid black; + border-radius: 10px; + width: 40%; + height: 500px; + background-color: #ffbd11; + text-align: center; +} +.action-bar { + display: flex; + justify-content: space-around; +} +.porcent-life { + width: 50%; + text-align: center; + padding: 10px 1px 0px; +} +#bar { + margin-top: 10%; + width: 100px; + height: 35px; + border-radius: 10px; + background: #1a46e5; +} +#life { + width: 100px; + height: 35px; + border-radius: 10px; + background: #ff89bb; +} + +#life2 { + width: 100px; + height: 35px; + border-radius: 10px; + background: #ff89bb; +} + +#button-circle { + display: inherit; + justify-content: center; + align-items: center; + width: 100px; + height: 100px; + background: #1a46e5; + border-radius: 50px; + box-shadow: 0px 10px 5px rgba(0, 0, 0, 0.6); +} + +#button-circle2 { + display: none; + justify-content: center; + align-items: center; + width: 100px; + height: 100px; + background: #1a46e5; + border-radius: 50px; + box-shadow: 0px 10px 5px rgba(0, 0, 0, 0.6); +} + +.character-box { + width: 80%; + height: 50%; + margin-top: 1em; + margin-left: auto; + margin-right: auto; + background: white; +} +.button-play { + color: white; + text-decoration: none; +} +a:hover { + color: white; + text-decoration: none; + cursor: pointer; +} + +.modal-body { + display: flex; + justify-content: space-around; +} + +.modal-body p { + font-size: 24px; +} +/* Footer */ +.footer { + display: flex; + justify-content: flex-end; + color: black; + position: fixed; + bottom: 0; + width: 100%; + height: 110px; +} +.footer-content { + display: inherit; + align-items: center; + padding: 5%; +} +/* Pages HTML */ + +/* +* Source de iconos +*/ +.logo-github { + display: block; + width: 48px; + height: 48px; + background: url(/fonts/icons8-github.svg); + background-size: 48px 48px; +} + +.logo-twitter { + display: block; + width: 48px; + height: 48px; + background: url(/fonts/icons8-twitter.svg); + background-size: 48px 48px; +} diff --git a/fonts/github.svg b/fonts/github.svg new file mode 100644 index 0000000..01bcb87 --- /dev/null +++ b/fonts/github.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fonts/icons8-github.svg b/fonts/icons8-github.svg new file mode 100644 index 0000000..9fdcc99 --- /dev/null +++ b/fonts/icons8-github.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/fonts/icons8-twitter.svg b/fonts/icons8-twitter.svg new file mode 100644 index 0000000..d9e59e9 --- /dev/null +++ b/fonts/icons8-twitter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..a5267c2 --- /dev/null +++ b/index.html @@ -0,0 +1,160 @@ + + + + + + + + + + + + Challege Master Platzi + + + +
+

Platzi Game

+
+
+
+

Player 1

+ +
+

100%

+
+ +
+ +
+
+
+ +
+ Play +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+

Player 2

+ +
+

100%

+
+ +
+ +
+
+
+ +
+ Play +
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + diff --git a/js/index.js b/js/index.js new file mode 100644 index 0000000..b52580f --- /dev/null +++ b/js/index.js @@ -0,0 +1,55 @@ +function accion() { + const buttonPlay = document.querySelector("#button-circle2"); + buttonPlay.style.display = "inherit"; + + var newLife = Math.ceil(Math.random() * 101) - 1; + const lifePorcent = document.querySelector("#porcent2"); + const life2 = document.querySelectorAll("#life2"); + + var index = 0, + length = life2.length; + for (index; index < length; index++) { + lifePorcent.innerHTML = newLife + "%"; + life2[index].style.width = newLife + "px"; + } + if (newLife == 0) { + drawGif("Player 1"); + } +} + +function accion2() { + var newLife = Math.ceil(Math.random() * 101) - 1; + const lifePorcent = document.querySelector("#porcent"); + const life2 = document.querySelectorAll("#life"); + + var index = 0, + length = life2.length; + for (index; index < length; index++) { + lifePorcent.innerHTML = newLife + "%"; + life2[index].style.width = newLife + "px"; + } + if (newLife == 0) { + drawGif("Player 2"); + } +} + +function drawGif(winner) { + const winnerLabel = document.querySelector("p"); + winnerLabel.innerHTML = "El ganador es " + winner; + var xhr = $.get( + "https://api.giphy.com/v1/gifs/random?api_key=lmcaocIixcCj7XOfEkijjvXs1b1tuMqe&tag=cartoon&rating=g" + ); + xhr + .done(function (data) { + console.log("success got data", data); + return data; + }) + .done(function (json) { + console.log(json); + var imgGif = json.data.images.fixed_height.url; + const imagenModal = document.getElementById("imgModal"); + imagenModal.src = imgGif; + }); + + $("#myModal").modal("show"); +}