๐ง♂️ Zombie Shooting Galore: A Thrilling HTML, CSS, JS Game Tutorial! ๐ฎ๐
Greetings, fellow code warriors and zombie hunters! Ready to unleash chaos with HTML, CSS, and JavaScript? Buckle up as we dive into the heart-pounding creation of a Zombie Shooting Game! ๐ป๐ซ
Introduction: In this spine-chilling tutorial, we'll walk through the process of crafting an immersive Zombie Shooting Game using the enchanting trio of HTML, CSS, and JavaScript. Prepare for a coding adventure filled with laughs, thrills, and the sweet taste of victory. Let the zombie apocalypse begin! ๐ง♂️๐
HTML Havoc: Our journey commences with HTML magic! Witness the creation of the game's foundation, setting the stage for an epic showdown between you and the undead. It's not just code; it's the blueprint of a zombie-infested battlefield. ๐๐น️
html<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Zombie Shooting</title><!--CSS LINK--><link rel="stylesheet" href="style.css" type="text/css" /><link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"><!--CSS LINK END--><!--Playable Ads Require--><meta name="ad.orientation" content="landscape" /><meta name="ad.size" content="width=480,height=320" /><script type="text/javascript">var clickTag = "#";</script><!--Requirement END--></head><body><main><div class="container-fluid m-0 p-0"><div class="playground mx-auto"><!--Navigation--><div class="weapon"><nav class="navbar"><div class="container-fluid"><div class="d-flex weapon" id="navbarNav"><ul class="navbar-nav me_tag"><li class="nav-item"><div class="h_nav nav_bg"><div class="img_box"><a class="nav-link"onclick="tryNow()"><imgsrc="resource/gun1.png"alt="Nature"id="t1"class="mx-auto img_wd"style="padding: 5px"/></a></div><div class="d-flex price_box"><p class="px-1 txt_price">$500</p><span class="d-flex my-auto ms-auto"><imgsrc="resource/dollar.png"alt="Nature"id="t1"class="img_icon"/></span></div></div></li><li class="nav-item"><div class="h_nav nav_bg"><div class="img_box"><a class="nav-link"><imgsrc="resource/gun2.png"alt="Nature"id="t1"class="img_wd"/></a></div><div class="d-flex price_box"><p class="px-1 txt_price">$1000</p><span class="d-flex my-auto ms-auto"><imgsrc="resource/dollar.png"alt="Nature"id="t1"class="img_icon"/></span></div></div></li><li class="nav-item"><div class="h_nav nav_bg"><div class="img_box"><a class="nav-link"><imgsrc="resource/gun3.png"alt="Nature"id="t1"class="img_wd"/></a></div><div class="d-flex price_box"><p class="px-1 txt_price">$2000</p><span class="d-flex my-auto ms-auto"><imgsrc="resource/dollar.png"alt="Nature"id="t1"class="img_icon"/></span></div></div></li></ul><!----><ul class="navbar-nav ms-auto ms_tag"><li class="nav-item ms-auto"><div class="d-flex price_won"><p class="px-1 txt_tag">$100</p><span class="d-flex my-auto ms-3"><imgsrc="resource/dollar.png"alt="Nature"id="t1"class="img_icon"/></span></div></li></ul></div></div></nav></div><!--Navigation End--><!--PlayGround Area--><div class="container-fluid m-0 p-0"><div class="row"><!--TRY NOW MODAL--><div class="modal m-0 p-0" id="tryModal" tabindex="-1"><div class="modal-dialog modal_padding"><div class="modal-content modal_bg d-flex"><div class="btn btn-close ms-auto text-danger" onclick="Modal()"></div><div class="modal-header" style="border: none"><h5 class="modal-title mx-auto" id="tryModalLabel"><!-- <img src="resource/wow.png" alt="" class="" /> --></h5></div><div class="modal-body d-flex"><div class="d-flex mx-auto"><div class="d-flex my-auto"><a href="javascript:window.open(window.clickTag)" class=""><img src="resource/trynow.png" alt="Treasure" id="mod_img" class="img_respo"></a></div></div></div><div class="modal-footer" style="border: none"></div></div></div></div><!--TRY NOW MODAL END--><div class="col-12 playing_zone" id="myweapon"><div class="col-1 p-0"><div class="play-area"><!--GUN--><div class="gun" id="myweaponfire"><a class="nav-link"><span><imgsrc="resource/gun.png"alt="Nature"id="t1"class="img_responsive shoot"/></span></a><a class="nav-link" onclick="fire()"><span><imgsrc="resource/hand.png"alt="Nature"id="t1"class="img_press pres"/></span></a><!--BULLET--><div class="bul_area gunfire" id="gun_fire"><img src="resource/bullet.png" alt="Bullet" class="bul" /></div></div></div></div><div class="col-8 p-0"><div class="play-area"><div class="zone z_runway" id="trail"><div class="zombie1" id="byshot1"><imgsrc="resource/skin1.png"alt="Nature"id="t1"class="img_zombie"/></div><div class="zombie2" id="byshot2"><imgsrc="resource/skin2.png"alt="Nature"id="t2"class="img_zombie"/></div><div class="zombie3" id="byshot3"><imgsrc="resource/skin3.png"alt="Nature"id="t3"class="img_zombie"/></div><div class="zombie4" id="byshot4"><imgsrc="resource/skin4.png"alt="Nature"id="t4"class="img_zombie"/></div><div class="zombie5" id="byshot5"><imgsrc="resource/skin5.png"alt="Nature"id="t5"class="img_zombie"/></div><div class="zombie6"><imgsrc="resource/skin6.png"alt="Nature"id="t1"class="img_zombie"/></div></div></div></div></div></div></div><!--PlayGround Area End--></div></div></main><!--SCRIPT LINK--><script type="text/javascript" src="main.js"></script><script>function tryNow(){document.getElementById('tryModal').style.display="block";}function Modal(){document.getElementById('tryModal').style.display="none";}</script><!--SCRIPT LINK END--></body></html>
CSS Slaughter: Time to bring some style to the slaughter! Our CSS is not just about aesthetics; it's about making sure you look fabulous while battling the undead. Get ready for a runway-worthy zombie showdown. ๐๐ฅ
css.playground {max-width: 480px !important;min-height: 320px !important;background: #3d3101;background-image: url(resource/bg.png);background-size: cover;background-repeat: no-repeat;}/*Top Area*/.weapon {width: 100%;}.navbar-nav {display: flex;flex-direction: row !important;padding-left: 0;margin-bottom: 0;list-style: none;}.nav-item {padding: 0;margin: 5px;}.navbar-nav .nav-link {padding: 0;}.img_box {width: 91px;height: 43px;}.h_nav {height: 70px;}.nav_bg {background-image: url(resource/nav.png);background-size: cover;background-repeat: no-repeat;}.img_wd {width: 82px;height: 45px;background-size: cover;display: flex;padding: 3px;}.txt_price {color: #ffecb3;font-size: 12px;}/* .me_tag{margin-left: -15px;}.ms_tag{margin-right: -15px;} */.txt_tag {color: #ffecb3;font-size: 16px;}.price_box {padding: 3px;margin: 3px;height: 21px;background-image: url(resource/nav_tag.png);}.img_icon {width: 21px;}.price_won {padding: 0;width: 85px;height: 25px;background: #e4355c;border-radius: 6px;}.playing_zone {position: fixed;display: flex;}.play-area {min-height: 210px;}.shoot {margin-top: 139px;}.gun {position: relative;margin-top: -63px;}.img_responsive {width: 70px;height: auto;background-size: cover;display: flex;position: absolute;}.img_press {width: 20px;height: auto;background-size: cover;display: flex;position: relative;}.pres {margin-top: 136px;left: 24px;}.bul_area {position: absolute;margin-left: 96px;margin-top: 150px;}.bul {position: absolute;width: 14px;height: auto;}.zone {margin-left: 54px;position: relative;display: flex;}.zombie1 {width: 20px;margin-top: 42px;margin-left: 108px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.zombie1_dead {transform: rotate(88deg);margin-top: 88px;margin-left: 39px;}/* .zombie1_dead {margin-top: 88px;margin-left: 39px;position: fixed;animation-name: example;background-repeat: no-repeat;animation-duration: 5s;transition: linear 0.5 infinite;}@keyframes example {/* 0% {background-image: url("resource/skin1.png");width: 30px;height: 130px;}50% {background-image: url("resource/skin1a.png");width: 30px;height: 130px;}100% {background-image: url("resource/skin1b.png");width: 150px;height: 30px;}/* from {background-image: url("resource/skin1a.png");width: 386px;height: 386px;}to {background-image: url("resource/skin1b.png");width: 386px;height: 386px;}} */.zombie2 {width: 20px;margin-top: 42px;margin-left: 158px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.zombie3 {width: 20px;margin-top: 42px;margin-left: 208px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.zombie4 {width: 20px;margin-top: 42px;margin-left: 258px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.zombie5 {width: 20px;margin-top: 42px;margin-left: 308px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.zombie6 {width: 20px;margin-top: 42px;margin-left: 358px;padding: 0.5rem 1rem;height: auto;background-size: cover;display: flex;position: absolute;}.img_zombie {background-size: cover;display: block;width: 36px;height: 128px;}.hide_zombie {display: none;}.shot {transform: rotate(88deg);margin-top: 88px;margin-left: 93px;}.aftrshot_gun {transform: rotate(45deg);margin-left: 50px;}/*Bullet Animation*/@-webkit-keyframes m_fire {0% {top: 0%;left: 10%;}25% {top: 0%;left: 20%;}75% {top: 0%;left: 440%;}}@keyframes m_fire {0% {top: 0%;left: 10%;}25% {top: 0%;left: 20%;}75% {top: 0%;left: 440%;}}.gunfire {display: none;position: absolute;width: 50px;height: auto;animation: m_fire 0.8s linear 0s infinite;-webkit-animation: m_fire 0.8s linear 0s infinite;-moz-animation: m_fire 0.8s linear 0s infinite;--0-animation: m_fire 0.8s linear 0s infinite;z-index: 1;}/*Bullet Animation End*//*After Shot Bullet Animation*/@-webkit-keyframes after_fire {0% {bottom: 25%;left: 10%;}10% {bottom: 20%;left: 20%;}25% {bottom: 10%;left: 240%;}100% {bottom: 0%;left: 300%;}}@keyframes after_fire {0% {bottom: 25%;left: 10%;}10% {bottom: 20%;left: 20%;}25% {bottom: 10%;left: 240%;}100% {bottom: 0%;left: 300%;}}.after_shot {display: none;position: absolute;width: 50px;height: auto;animation: after_fire 0.8s linear 0s infinite;-webkit-animation: after_fire 0.8s linear 0s infinite;-moz-animation: after_fire 0.8s linear 0s infinite;--0-animation: after_fire 0.8s linear 0s infinite;z-index: 1;}/*After Shot Bullet Animation End*//*Zombie Trail*/@-webkit-keyframes a {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}@keyframes a {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}.trail_a {animation: a 0.8s linear 0s infinite;-webkit-animation: a 0.8s linear 0s infinite;-moz-animation: a 0.8s linear 0s infinite;--0-animation: a 0.8s linear 0s infinite;z-index: 1;}@-webkit-keyframes b {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}@keyframes b {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}.trail_b {margin-left: -12px;animation: b 0.8s linear 0s infinite;-webkit-animation: b 0.8s linear 0s infinite;-moz-animation: b 0.8s linear 0s infinite;--0-animation: b 0.8s linear 0s infinite;z-index: 1;}@-webkit-keyframes c {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}@keyframes c {0% {top: 0%;left: 0%;}10% {top: 0%;left: 0%;}20% {top: 0%;left: 0%;}30% {top: 0%;left: 0%;}40% {top: 0%;left: 0%;}50% {top: 0%;left: 0%;}}.trail_c {margin-left: -48px;animation: c 0.8s linear 0s infinite;-webkit-animation: c 0.8s linear 0s infinite;-moz-animation: c 0.8s linear 0s infinite;--0-animation: c 0.8s linear 0s infinite;z-index: 1;}/**/@-webkit-keyframes runway {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}@keyframes runway {0% {top: 0%;left: 0%;}10% {top: 0%;left: -10%;}20% {top: 0%;left: -20%;}30% {top: 0%;left: -30%;}40% {top: 0%;left: -40%;}50% {top: 0%;left: -50%;}}.z_runway {animation: runway 3s linear 0s infinite;-webkit-animation: runway 3s linear 0s infinite;-moz-animation: runway 3s linear 0s infinite;--0-animation: runway 3s linear 0s infinite;z-index: 1;}/**//*Zombie Trail*//*TRY NOW MODAL*/.modal-content {position: relative;display: flex;flex-direction: column;width: 480px;height: 320px;pointer-events: auto;background-color: #fff;background-clip: padding-box;border: 1px solid rgba(0,0,0,.2);border-radius: 0.3rem;outline: 0;}.modal_padding {max-width: 480px !important;max-height: 320px !important;background-size: cover;left: 0;right: 0;top: 0;bottom: 0;margin: 0 !important;padding: 0;overflow: hidden;}.modal_bg {padding-bottom:40px;background-color: #4016478c !important;background-image: url(resources/Vector.png);background-repeat: no-repeat;background-position: center;opacity: 0;animation: myTok 0.3s linear 0.2s;animation-fill-mode: forwards;}@keyframes myTok {from {opacity: 0;}to {opacity: 1;}}.img_respo{width: 175px;height: auto;}
JS Carnage: Get ready for the JavaScript carnage! This is where the magic happens, turning your screen into a battlefield of undead chaos. Let the coding wizardry begin! ๐ง♂️✨
javascriptlet shotCount = 0;function fire() {document.getElementById("gun_fire").style.display = "block";setTimeout(function () {document.getElementById("gun_fire").style.display = "none";}, 500);var getShot = document.getElementById("trail");getShot.classList.remove("z_runway");if (shotCount > 12) {alert("No more shots.");return false;}switch (shotCount) {case 1:if (shotCount = 1) {var shott = document.getElementById("byshot1");var aftershott = document.getElementById("myweaponfire");setTimeout(function () {shott.classList.add("zombie1_dead");aftershott.classList.add("aftrshot_gun");setTimeout(function () {document.getElementById("byshot1").style.display = "none";setTimeout(function () {document.getElementById("trail").classList.remove("zone");document.getElementById("trail").classList.add("trail_a");}, 1000);shott.classList.remove("zombie1_dead");aftershott.classList.remove("aftrshot_gun");}, 800);}, 1000);}break;case 3:if (shotCount = 3) {var shott1 = document.getElementById("byshot2");var aftershott1 = document.getElementById("myweaponfire");setTimeout(function () {shott1.classList.add("shot");aftershott1.classList.add("aftrshot_gun");setTimeout(function () {document.getElementById("byshot2").style.display = "none";setTimeout(function () {document.getElementById("trail").classList.remove("trail_a");document.getElementById("trail").classList.remove("trail_b");document.getElementById("trail").classList.add("trail_c");}, 1000);shott1.classList.remove("shot");aftershott1.classList.remove("aftrshot_gun");}, 800);}, 1000);}break;case 5:if (shotCount = 5) {var shott2 = document.getElementById("byshot3");var aftershott2 = document.getElementById("myweaponfire");setTimeout(function () {shott2.classList.add("shot");aftershott2.classList.add("aftrshot_gun");setTimeout(function () {document.getElementById("byshot3").style.display = "none";setTimeout(function () {document.getElementById("trail").classList.remove("trail_a");document.getElementById("trail").classList.remove("trail_b");document.getElementById("trail").classList.add("trail_c");}, 1000);shott2.classList.remove("shot");aftershott2.classList.remove("aftrshot_gun");}, 800);}, 1000);}break;default:break;}shotCount++;}
Conclusion - Victory Lap: As we wrap up this thrilling tutorial, you've not only conquered the undead but also infused your Zombie Shooting Game with a touch of your coding brilliance. Share the excitement, shoot your way to triumph, and stay tuned for more heart-pounding coding adventures! ๐๐ง♂️
#ZombieShootingMayhem #HTMLHorror #CSSSlaughter #JSCarnage #CodeLikeTheUndeadAreWatching ๐๐ฅ
Comments
Post a Comment