diff --git a/Games/Elephant_ant_man/README.md b/Games/Elephant_ant_man/README.md new file mode 100644 index 0000000000..cc4ad72277 --- /dev/null +++ b/Games/Elephant_ant_man/README.md @@ -0,0 +1,34 @@ +# **Elephant_ant_man** + +--- + +
+ +## **Description 📃** + +It is a cuter version of the classic game rock paper scissors. It is inspired by the famous bedtime story the ant and the elephant where the ant despite his small size teaches a lesson to the elephant. +- + +## **Functionalities 🎮** + +->the user can select one of the three choices and a message will display on the screen if the user won or lost. if the user lost the computer gets the point and vice versa. +- +
+ +## **How to play? 🕹ī¸** + +click on any of the three images +the computer will randomly select a choice of his own +score will be updated as you won or lost +its a endless game enjoy playing + +
+ +## **Screenshots 📸** + +
+ +[image](screenshot.png) + + +
diff --git a/Games/Elephant_ant_man/ant.jpg b/Games/Elephant_ant_man/ant.jpg new file mode 100644 index 0000000000..10960981a5 Binary files /dev/null and b/Games/Elephant_ant_man/ant.jpg differ diff --git a/Games/Elephant_ant_man/boyy.jpg b/Games/Elephant_ant_man/boyy.jpg new file mode 100644 index 0000000000..fa149e3051 Binary files /dev/null and b/Games/Elephant_ant_man/boyy.jpg differ diff --git a/Games/Elephant_ant_man/elephant.jpg b/Games/Elephant_ant_man/elephant.jpg new file mode 100644 index 0000000000..732c04f26a Binary files /dev/null and b/Games/Elephant_ant_man/elephant.jpg differ diff --git a/Games/Elephant_ant_man/index.html b/Games/Elephant_ant_man/index.html new file mode 100644 index 0000000000..3aca5aac43 --- /dev/null +++ b/Games/Elephant_ant_man/index.html @@ -0,0 +1,37 @@ + + + + + + ROCK,PAPER and SCISSORS + + + +

Ant, Boy and Elephant

+
+
+ +
+
+ +
+
+ +
+
+
+
+

0

+

You

+
+
+

0

+

Computer

+
+
+
+

Play your move!

+
+ + + \ No newline at end of file diff --git a/Games/Elephant_ant_man/screenshot.png b/Games/Elephant_ant_man/screenshot.png new file mode 100644 index 0000000000..425431d04f Binary files /dev/null and b/Games/Elephant_ant_man/screenshot.png differ diff --git a/Games/Elephant_ant_man/script.js b/Games/Elephant_ant_man/script.js new file mode 100644 index 0000000000..6d49854750 --- /dev/null +++ b/Games/Elephant_ant_man/script.js @@ -0,0 +1,64 @@ +let userScore=0; +let compScore=0; + +const choices = document.querySelectorAll(".choice"); +const msg=document.querySelector("#msg"); +const userScorePara=document.querySelector("#userscore"); +const compScorePara=document.querySelector("#compscore"); + +const genCompChoice = () => { + const options=["Boy","Elephant","Ant"]; + const randIdx=Math.floor(Math.random()*3); + return options[randIdx]; +} +const drawGame=()=>{ + console.log("It's a tie. Play again!") + msg.innerText="It's a tie. Play again!" + msg.style.backgroundColor="rgb(109, 130, 100)" +} +const showWinner=(userWin, userChoice, compChoice)=>{ + if(userWin){ + console.log("Congratulations! You won.") + userScore++; + userScorePara.innerText =userScore; + msg.innerText=`Congratulations! You won. ${userChoice} beats the ${compChoice}` + msg.style.backgroundColor="green"; + } + else{ + console.log("Sorry you lost, better luck next time.") + compScore++; + compScorePara.innerText=compScore; + msg.innerText=`Sorry you lost, better luck next time. ${userChoice} lost to the ${compChoice}` + msg.style.backgroundColor="red"; + } +} + +const playGame= (userChoice)=>{ + console.log("userchoice = ", userChoice); + const compChoice=genCompChoice(); + console.log("compChoice= ", compChoice); + + if (userChoice==compChoice){ + drawGame(); + }else{ + let userWin=true; + if(userChoice=="Boy"){ + userWin=compChoice==="Elephant"? false:true; + } + else if(userChoice=="Elephant"){ + userWin=compChoice==="Ant"? false:true; + } + else{ + userWin=compChoice==="Boy"? false:true; + } + showWinner(userWin, userChoice, compChoice); + + } +}; + +choices.forEach((choice)=>{ + choice.addEventListener("click",()=>{ + const userChoice= choice.getAttribute("id"); + playGame(userChoice); + }); +}); \ No newline at end of file diff --git a/Games/Elephant_ant_man/style.css b/Games/Elephant_ant_man/style.css new file mode 100644 index 0000000000..80aa99d53a --- /dev/null +++ b/Games/Elephant_ant_man/style.css @@ -0,0 +1,64 @@ +*{ + margin:0; + padding:0; + text-align: center; + background-color: rgb(217, 251, 223); +} +h1 { + background-color: rgb(109, 130, 100); + color: azure; + height: 80px; + line-height: 80px; + font: 80px; + +} +.choice:hover{ + opacity: 0.5; + cursor:grab; +} +.choice{ + height: 200px; + width: 200px; + border-radius: 50%; +} +img{ + height:175px; + width:175px; + border-radius: 50%; + object-fit: cover; + +} +.choices{ + display:flex; + justify-content: center; + align-items: center; + gap:50px; + margin-top: 90px; +} + +.scoreboard{ + display:flex; + justify-content: center; + align-items: center; + gap:100px; + margin-top:40px; + font-size:40px; + color:rgb(53, 76, 53) +} +#userscore,#compscore{ + font-size:60px; +} +#msg{ + background-color: rgb(109, 130, 100); + color:azure; + font-size:35px; + font-style:italic; + height:60px; + display:inline; + padding: 20px; + border-radius: 1rem; + +} +.msgcontainer{ + margin-top: 60px; +} diff --git a/README.md b/README.md index c8619d615a..44dbab0580 100644 --- a/README.md +++ b/README.md @@ -1193,6 +1193,7 @@ This repository also provides one such platforms where contributers come over an | [LaserDarts](https://github.com/Jagpreet153/GameZone/tree/main/Games/LaserDarts) | [Block Building](https://github.com/kunjgit/GameZone/tree/main/Games/Block_Building) | | [Flames Game](https://github.com/kunjgit/GameZone/tree/main/Games/Flames_Game)| + | [NewsJunction](https://github.com/kunjgit/GameZone/tree/main/Games/NewsJunction) | |[Ping_Pong_Singleplayer](https://github.com/kunjgit/GameZone/tree/main/Games/Ping_Pong_Singleplayer) | | [MazeRunner](https://github.com/kunjgit/GameZone/tree/main/Games/MazeRunner) | @@ -1215,6 +1216,7 @@ This repository also provides one such platforms where contributers come over an |[Building Blocks Game](https://github.com/kunjgit/GameZone/tree/main/Games/Building_Block_Game)| |[Cartoon character guessing game](https://github.com/kunjgit/GameZone/tree/main/Games/Cartoon_Character_Guessing_Game)| |[Align_4_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Align_4_Game)| + |[Carrom Board Game](https://github.com/kunjgit/GameZone/tree/main/Games/carrom)| | [Tic-Tac-Toe Game](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-Tac-Toe) | | [Number_Recall_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Recall_Game) | @@ -1239,6 +1241,8 @@ This repository also provides one such platforms where contributers come over an | [Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) | | [Gravity_Simulation_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Simulation_Game) | | [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy) + +|[Elephant_ant_man](https://github.com/tanishkaa08/GameZone/tree/main/Games/Elephant_ant_man) | [Catch_The_Ball](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_The_Ball) | | [Ball_in_Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_in_Maze) | |[Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) | @@ -1270,6 +1274,7 @@ This repository also provides one such platforms where contributers come over an | [Bunny is Lost](https://github.com/kunjgit/GameZone/tree/main/Games/Bunny_is_Lost)| |[Steam_Punk](https://github.com/kunjgit/GameZone/tree/main/Games/Steam_Punk)| + |[OutRun_Offline_Game](https://github.com/kunjgit/GameZone/tree/main/Games/OutRun_Offline_Game)| |[Tower Defence Game](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Tower_Defence_Game)| @@ -1309,8 +1314,6 @@ This repository also provides one such platforms where contributers come over an |[Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys)| |[Snake_Gun_Water](https://github.com/kunjgit/GameZone/tree/main/Games/Snake_Gun_Water)| |[Tether](https://github.com/kunjgit/GameZone/tree/main/Games/Tether)| - - |[Rock Paper Scissors Lizard Spock Game](./Games/Rock_Paper_Scissors_Lizard_Spock_Game)| |[Hangman_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Hangman_Game)| @@ -1319,7 +1322,7 @@ This repository also provides one such platforms where contributers come over an
-

Page with Curl Contributing Guideline

+

Page with Curl Contributing Guideline


diff --git a/assets/images/screenshot.png b/assets/images/screenshot.png new file mode 100644 index 0000000000..425431d04f Binary files /dev/null and b/assets/images/screenshot.png differ