From 7fd5da2e21cdbe10ae1032430aad8f3ebd24480e Mon Sep 17 00:00:00 2001 From: Raymundo Solis Date: Thu, 13 Aug 2020 23:58:46 -0500 Subject: [PATCH 1/4] iniciamos el challenge --- css/styles.css | 36 ++++++++++++++++++++++++++++++++++++ index.html | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 css/styles.css create mode 100644 index.html diff --git a/css/styles.css b/css/styles.css new file mode 100644 index 0000000..b09392d --- /dev/null +++ b/css/styles.css @@ -0,0 +1,36 @@ +/* General */ +body { + font-family: "Poppins", sans-serif; + margin: 0; +} + +div { + border: 1px solid red; +} + +.container { + max-width: 1000px; + flex: 1; + margin: 0 auto; + display: flex; + justify-content: space-around; +} +/* Estilos tipográficos */ + +/* Header */ + +/* Body */ + +/* Footer */ +.footer { + color: white; + background-color: rgba(35, 59, 74, 0.9); + display: flex; + align-items: center; + justify-content: space-between; +} +/* Pages HTML */ + +/* +* Source de iconos +*/ diff --git a/index.html b/index.html new file mode 100644 index 0000000..9bd41fa --- /dev/null +++ b/index.html @@ -0,0 +1,34 @@ + + + + + + + + Challege Master Platzi + + + +
+

Challenge

+
+
+
+
+

Hola esto es un parrafo

+
+
+

Hola esto es otro parrafo

+
+
+
+ + + From 1fde4d216e0486ca9c89dbc528349bdce6162a2a Mon Sep 17 00:00:00 2001 From: Raymundo Solis Date: Sat, 15 Aug 2020 09:00:47 -0500 Subject: [PATCH 2/4] =?UTF-8?q?Dise=C3=B1o=20preliminar=20funcionando?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/styles.css | 89 +++++++++++++++++++++++++++++++++++++++++++------- index.html | 29 +++++++++------- 2 files changed, 95 insertions(+), 23 deletions(-) diff --git a/css/styles.css b/css/styles.css index b09392d..0a6b10d 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1,13 +1,27 @@ /* General */ -body { - font-family: "Poppins", sans-serif; +* { margin: 0; + padding: 0; } -div { - border: 1px solid red; +h1 { + text-align: center; } +/* 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; @@ -15,19 +29,72 @@ div { display: flex; justify-content: space-around; } -/* Estilos tipográficos */ -/* Header */ +.player1 { + color: white; + border: 1px solid black; + border-radius: 10px; + width: 40%; + height: 350px; + background-color: #43d8c9; + text-align: center; +} +.player2 { + color: white; + border: 1px solid black; + border-radius: 10px; + width: 40%; + height: 350px; + background-color: #ffbd11; + text-align: center; +} +.action-bar { + display: flex; + justify-content: space-around; + margin-top: 10%; +} +#bar { + margin-top: 10%; + width: 100px; + height: 35px; + border-radius: 10px; + background: #1a46e5; +} +#life { + width: 50px; + height: 35px; + border-radius: 10px; + background: #ff89bb; +} -/* Body */ +#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); +} + +.character-box { + width: 80%; + height: 43%; + margin-top: 1em; + margin-left: auto; + margin-right: auto; + background: white; +} /* Footer */ .footer { - color: white; - background-color: rgba(35, 59, 74, 0.9); display: flex; - align-items: center; - justify-content: space-between; + justify-content: flex-end; + color: black; + position: fixed; + bottom: 0; + width: 100%; } /* Pages HTML */ diff --git a/index.html b/index.html index 9bd41fa..aca015f 100644 --- a/index.html +++ b/index.html @@ -12,23 +12,28 @@ -
-

Challenge

+
+

Platzi Game

-
-
+
+
+

Player 1

-

Hola esto es un parrafo

-
-
-

Hola esto es otro parrafo

+
+
+
+
+
Play
+
+
-
-
+ From 07804abb4dab9ab4827564765745c57bf632868a Mon Sep 17 00:00:00 2001 From: Raymundo Solis Date: Sat, 15 Aug 2020 09:11:35 -0500 Subject: [PATCH 3/4] Detalles de boton --- css/styles.css | 9 +++++++++ index.html | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/css/styles.css b/css/styles.css index 0a6b10d..78b4bf3 100644 --- a/css/styles.css +++ b/css/styles.css @@ -86,6 +86,15 @@ body { margin-right: auto; background: white; } +.button-play { + color: white; + text-decoration: none; +} +a:hover { + color: white; + text-decoration: none; + cursor: pointer; +} /* Footer */ .footer { diff --git a/index.html b/index.html index aca015f..d47cf2f 100644 --- a/index.html +++ b/index.html @@ -23,7 +23,10 @@

Player 1

-
Play
+ +
+ PLAY +
From 166c0fade26a12614d656e0075bae2f13001d881 Mon Sep 17 00:00:00 2001 From: Raymundo Solis Date: Sun, 16 Aug 2020 23:56:27 -0500 Subject: [PATCH 4/4] primer dibujo y juego funcionando --- css/characters.css | 266 +++++++++++++++++++++++++++++++++++++++ css/styles.css | 68 +++++++++- fonts/github.svg | 48 +++++++ fonts/icons8-github.svg | 1 + fonts/icons8-twitter.svg | 1 + index.html | 140 +++++++++++++++++++-- js/index.js | 55 ++++++++ 7 files changed, 562 insertions(+), 17 deletions(-) create mode 100644 css/characters.css create mode 100644 fonts/github.svg create mode 100644 fonts/icons8-github.svg create mode 100644 fonts/icons8-twitter.svg create mode 100644 js/index.js 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 index 78b4bf3..b70ee55 100644 --- a/css/styles.css +++ b/css/styles.css @@ -7,6 +7,9 @@ h1 { text-align: center; } +h3 { + padding-top: 15px; +} /* Estilos tipográficos */ /* Header */ @@ -29,13 +32,15 @@ body { display: flex; justify-content: space-around; } - +.content-draw { + padding: 5%; +} .player1 { color: white; border: 1px solid black; border-radius: 10px; width: 40%; - height: 350px; + height: 500px; background-color: #43d8c9; text-align: center; } @@ -44,14 +49,18 @@ body { border: 1px solid black; border-radius: 10px; width: 40%; - height: 350px; + height: 500px; background-color: #ffbd11; text-align: center; } .action-bar { display: flex; justify-content: space-around; - margin-top: 10%; +} +.porcent-life { + width: 50%; + text-align: center; + padding: 10px 1px 0px; } #bar { margin-top: 10%; @@ -61,7 +70,14 @@ body { background: #1a46e5; } #life { - width: 50px; + width: 100px; + height: 35px; + border-radius: 10px; + background: #ff89bb; +} + +#life2 { + width: 100px; height: 35px; border-radius: 10px; background: #ff89bb; @@ -78,9 +94,20 @@ body { 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: 43%; + height: 50%; margin-top: 1em; margin-left: auto; margin-right: auto; @@ -96,6 +123,14 @@ a:hover { cursor: pointer; } +.modal-body { + display: flex; + justify-content: space-around; +} + +.modal-body p { + font-size: 24px; +} /* Footer */ .footer { display: flex; @@ -104,9 +139,30 @@ a:hover { 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 index d47cf2f..a5267c2 100644 --- a/index.html +++ b/index.html @@ -4,10 +4,17 @@ + + + + Challege Master Platzi @@ -18,25 +25,136 @@

Platzi Game

Player 1

-
-
-
-
-
- -
- PLAY -
+ +
+

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"); +}