Hangman
How do I make an hangman?
What is a hangman? How do you make a hangman? This script and codes were developed by Harley Santos Garzón on 31 January 2023, Tuesday.
Hangman - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>hangman</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='css/vgvngz.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<main class="templateApplication"> <div class="templateContent mt40"> <div class="game__hangman game__hangman1"> <div class="game__hangman--hiddenImg" style="background-image:url('http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/fondo.png')"><img class="responsive-img hiddenImg lingote_1 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_1.png"/><img class="responsive-img hiddenImg lingote_2 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_2.png"/><img class="responsive-img hiddenImg lingote_3 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_3.png"/><img class="responsive-img hiddenImg lingote_4 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_4.png"/><img class="responsive-img hiddenImg lingote_5 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_5.png"/><img class="responsive-img hiddenImg lingote_6 is--visible" src="http://bbdigitaldemo.com/00.material_apoyo/UNAD_business/hangman/lingote_6.png"/></div> <!----> <div class="game__hangman--findWord"> <div class="game__hangman--findWord-word"> <div class="game__hangman--findWord-letter letter"></div> <div class="game__hangman--findWord-letter letter"></div> <div class="game__hangman--findWord-letter letter"></div> <div class="game__hangman--findWord-letter letter"></div> <div class="game__hangman--findWord-letter letter"></div> <div class="game__hangman--findWord-letter letter"></div> </div> </div> <!----> <div class="game__hangman--keyBoard"> <div class="game__hangman--keyBoard--line"> <div class="game__hangman--keyBoard-key key" pos="0" value="Q" disabled="disabled">Q</div> <div class="game__hangman--keyBoard-key key" pos="0" value="W" disabled="disabled">W</div> <div class="game__hangman--keyBoard-key key" pos="0" value="E" disabled="disabled">E</div> <div class="game__hangman--keyBoard-key key" pos="0" value="R" disabled="disabled">R</div> <div class="game__hangman--keyBoard-key key" pos="0" value="T" disabled="disabled">T</div> <div class="game__hangman--keyBoard-key key" pos="0" value="Y" disabled="disabled">Y</div> <div class="game__hangman--keyBoard-key key" pos="0" value="U" disabled="disabled">U</div> <div class="game__hangman--keyBoard-key key" pos="0" value="I" disabled="disabled">I</div> <div class="game__hangman--keyBoard-key key" pos="0" value="O" disabled="disabled">O</div> <div class="game__hangman--keyBoard-key key" pos="0" value="P" disabled="disabled">P</div> </div> <div class="game__hangman--keyBoard--line"> <div class="game__hangman--keyBoard-key key" pos="0" value="A" disabled="disabled">A</div> <div class="game__hangman--keyBoard-key key" pos="0" value="S" disabled="disabled">S</div> <div class="game__hangman--keyBoard-key key" pos="0" value="D" disabled="disabled">D</div> <div class="game__hangman--keyBoard-key key" pos="0" value="F" disabled="disabled">F</div> <div class="game__hangman--keyBoard-key key" pos="0" value="G" disabled="disabled">G</div> <div class="game__hangman--keyBoard-key key" pos="0" value="H" disabled="disabled">H</div> <div class="game__hangman--keyBoard-key key" pos="0" value="J" disabled="disabled">J</div> <div class="game__hangman--keyBoard-key key" pos="0" value="K" disabled="disabled">K</div> <div class="game__hangman--keyBoard-key key" pos="0" value="L" disabled="disabled">L</div> </div> <div class="game__hangman--keyBoard--line"> <div class="game__hangman--keyBoard-key key" pos="0" value="Z" disabled="disabled">Z</div> <div class="game__hangman--keyBoard-key key" pos="0" value="X" disabled="disabled">X</div> <div class="game__hangman--keyBoard-key key" pos="0" value="C" disabled="disabled">C</div> <div class="game__hangman--keyBoard-key key" pos="0" value="V" disabled="disabled">V</div> <div class="game__hangman--keyBoard-key key" pos="0" value="B" disabled="disabled">B</div> <div class="game__hangman--keyBoard-key key" pos="0" value="N" disabled="disabled">N</div> <div class="game__hangman--keyBoard-key key" pos="0" value="M" disabled="disabled">M</div> </div> </div> </div> </div>
</main> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Hangman - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Lato);
@import url('https://fonts.googleapis.com/css?family=Raleway');
//Reset básico -- Basic reset * { box-sizing: border-box; margin: 0; padding: 0; text-decoration: none; font-weight: normal; font-family: 'Lato'; color: $noche; } ul{ li{ list-style: none; } } a{ } h1, h2, h3, h4, h5, h6{ font-family: 'Raleway', sans-serif; margin-bottom: 10px; }
//-- Estructura proyecto body{ background-color: $gray; } .template{ &Application{ position: relative; top: 0; left: 0; min-height: 100vh; height: 100%; width: 100%; z-index: 10; overflow: hidden; overflow-y: auto; // } &Content{ width: 90%; //min-width: 768px; max-width: 1280px; margin: auto; } }
.game{ &__hangman{ position : relative; width : 100%; height : 100%; // @include flexbox; @include flex-direction(column); @include justify-content(flex-end); //@include align-items(center); // min-width : 748px; max-width : 768px; min-height : 430px; max-height : 500px; // margin : auto; // estilos comunes // ===================================== &--keyBoard, &--findWord, &--hiddenImg{ position: relative; z-index: 2; } // ===================================== // imagen de fondo > imagen de ahorcado // ===================================== &--hiddenImg{ position: absolute; top: 0; left: 0; width: 100%; height: 420px; @include flexbox; @include justify-content(center); @include flex(1 0 auto); background-size: 768px 420px; background-repeat: no-repeat; background-position: center; .hiddenImg{ $topImage: 3em; opacity: 0; top: 3rem; left: auto; right: auto; position: absolute; width: 150px; &.is--visible{ opacity: 1; } // &:nth-child(1){ top: $topImage - .6em; left: 41%; z-index: 6; } &:nth-child(2){ top: $topImage + .7em; left: 37%; z-index: 4; } &:nth-child(3){ top: $topImage + 2.8em; left: 45%; z-index: 5; } &:nth-child(4){ top: $topImage + 2em; left: 34%; z-index: 1; } &:nth-child(5){ top: $topImage + 4em; left: 42%; z-index: 2; } &:nth-child(6){ top: $topImage + 6em; left: 50%; z-index: 3; } } } // teclado // ===================================== // ===================================== // Palabra a buscar // ===================================== &--findWord{ @include flexbox; @include justify-content(center); // min-width: 50%; max-width: 90%; margin: 0 auto; // &-letter{ width: 30px; height: 30px; background-color: #fff; box-shadow: 0px 0px 0px 2px rgba(157, 179, 188, 1) inset; border-radius: 5px; // @include flexbox; @include justify-content(center); @include align-items(center); } &-word{ @include flexbox; @include justify-content(center); @include flex-wrap(wrap); padding: 0 .5rem; max-width: 100%; &:first-child{ padding-left: 0; } } } // teclado // ===================================== &--keyBoard{ // @include flexbox; @include justify-content(center); @include align-items(center); @include flex-wrap(wrap); // width: 70%; min-height: 35px; padding: 5px 0; margin: 0 auto; background-color: transparent; // &--line{ @include flexbox; @include justify-content(center); @include align-items(center); min-height: 35px; } // &-key { width: 30px; height: 30px; z-index: 20; outline: none; margin: 0 4px 0 0; border-radius: 5px; background-color: #e1f4fd; border: none; color: #606a70; font-size: 18px; line-height: 25px; text-align: center; cursor: pointer; box-shadow: 1px 3px 0px 0px rgba(157, 179, 188, 1); &:hover, &:active, &.press{ background-color: #fff; color: #606a70; } &:active, &.press, &.bien, &.mal{ box-shadow: 0px 1px 0px 0px rgba(157, 179, 188, 1); } &.bien, &.mal{ color: white; } } } // ===================================== &:after{ // content: url(data-bg); position: absolute; top: 0; left: 0; height: 100%; max-height : 420px; width: 100%; z-index: 1; //background-image: url('http://bbdigitaldemo.com/demo_B-teens/templates/level-1/module-1/img/24/bgTree.png'); background-size: 748px 420px; background-repeat: no-repeat; background-position: center; } // ===================================== }
}
.bien{ background-color: green !important; color: white !important;
}
.mal{ background-color: red !important; color: white !important;
}
Hangman - Script Codes JS Codes
var correctas = 0;
var contp=0;
var verificar;
function soup_letter(array,letter,item,itemLetra,parent,ahor,pos){ //console.log(pos); var letra = letter.text().toLowerCase(); var respuesta = array; verificar = respuesta.indexOf(letra); if(verificar != -1){ for (var i = 0; i < respuesta.length; i++) { if(letra == respuesta[i]){ contar(respuesta.length, pos); $(item).eq(i).text(respuesta[i]); letter.addClass('bien'); } } } else { letter.addClass('mal'); contar_malas(parent); }
}
function contar_malas(parent){ contp ++; //console.log(`total malas ${contp}`); //console.log(`${parent} .lingote_${contp}`); let cur= document.querySelector(`${parent} .lingote_${contp}`); if(contp==1){ cur.classList.remove("is--visible"); } if(contp==2){ cur.classList.remove("is--visible"); } if(contp==3){ cur.classList.remove("is--visible"); } if(contp==4){ cur.classList.remove("is--visible"); } if(contp==5){ cur.classList.remove("is--visible"); } if(contp==6){ cur.classList.remove("is--visible"); alert(`Opps!!, Try Again`); reset_aho(parent); }
}
function reset_aho(parent){ contp = 0; //$(".cuerpo").css("display","none"); $(".game__hangman--findWord-letter").text("") $(".game__hangman--keyBoard-key").removeClass('mal'); $(".game__hangman--keyBoard-key").removeClass("sel"); $(".game__hangman--keyBoard-key").removeClass("bien"); $(".game__hangman--hiddenImg .hiddenImg").addClass("is--visible"); $('#correcta').val(correctas=0); $('#envio').val(0);
}
function contar(total, pos, parent){ correctas ++; //console.log(`Letra ${pos}, Correctas: ${correctas} -> total: ${total}`) if(correctas == total){ reset_aho(parent); if (confirm("Press a button!") == true) { $(".game__hangman--keyBoard-key").removeClass("sel"); $(".game__hangman--keyBoard-key").removeClass("bien"); } else { $(".game__hangman--keyBoard-key").removeClass("sel"); $(".game__hangman--keyBoard-key").removeClass("bien"); } } //(correctas == total+1) ? 'loop' : '' ;
}
$(".game__hangman1 .key").click(function() { var pos = $( this ).text(); soup_letter( ['a', 'c', 't', 'i', 'n', 'g'], $(this), '.letter', '.key', '.game__hangman--hiddenImg', '.lost1', pos ); });
Developer | Harley Santos Garzón |
Username | HarleySG |
Uploaded | January 31, 2023 |
Rating | 3 |
Size | 19,971 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Timelinr Horizontal Custom | 6,171 Kb |
Simple Exercise angular app | 3,755 Kb |
JavaScript insertAdjacentElement | 4,241 Kb |
Angular-deckgrid - Like Pinterest Layout | 10,518 Kb |
Gestor de Actividades con Jquery y Materialize | 2,689 Kb |
Modal Image - bootstrap | 2,337 Kb |
Sortable grid | 5,397 Kb |
Custom Layout with Flexbox | 11,982 Kb |
SVG loading infinite | 2,936 Kb |
Gallery Custom Javascript - Jquery | 2,820 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A Pen by Brendan Skousen | Bskousen | 2,954 Kb |
SVG Text Masking | JMChristensen | 2,141 Kb |
Fading Navigation Bar | J-w-v | 2,805 Kb |
Incremental game | Eprouver | 5,868 Kb |
Simple personal profile | Miroot | 2,856 Kb |
Gulpfile | Aimhigherwebdesign-amy | 1,765 Kb |
Parallax with only CSS | Thulioph | 2,297 Kb |
Google Maps API Ground Overlay | Boycetrus | 2,961 Kb |
Single element checkbox | Ivijaygupta | 1,996 Kb |
TweetBox with React JS | J0zelito | 3,325 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!