Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New game madlibs #4807

Merged
merged 6 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions Games/Madlibs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# **Madlibs**

---

<br>

## **Description 📃**

- Welcome to the Mad Libs Game, a fun and interactive word game that lets you create hilarious and unique stories by filling in the blanks! Simply enter a series of words—nouns, verbs, adjectives, and adverbs—and watch as your chosen words are placed into a pre-written story template. The result is a whimsical and often absurd tale that is sure to make you laugh. Perfect for parties, family gatherings, or just a bit of creative fun on your own, this game is a great way to enjoy some light-hearted entertainment. Get ready to unleash your imagination and see where the story takes you!



## **Functionalities 🎮**

- Multiple input fields for various parts of speech (nouns, verbs, adjectives, adverbs) to fill in the blanks for the story.
- A simple and intuitive form interface for entering words.
- Generates a unique story based on the user's input words.
- A button to submit the form and generate the story dynamically.
- A section to display the generated story, which only appears after the story is created.
- Easily customizable story template to create different versions or extend the game with additional input fields.

<br>

## **How to play? 🕹️**

1. Fill in each input field with the requested type of word (noun, verb, adjective, adverb, etc.). Be creative and have fun with your choices!
2. Once you have filled in all the fields, click the "Generate Mad Lib" button.
3. After clicking the button, your custom Mad Libs story will appear below the form. Enjoy reading the hilarious and unique story that you created!
4. Want to create another story? Simply change the words in the input fields and click the "Generate Mad Lib" button again to see a new story.


<br>

## **Screenshots 📸**

![image](https://github.com/AaryanManghnani/GameZone/blob/New-Game-Madlibs/assets/images/Madlibs.png)


<br>
47 changes: 47 additions & 0 deletions Games/Madlibs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mad Libs Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Mad Libs Game</h1>
<form id="madLibsForm">
<label for="noun1">Noun:</label>
<input type="text" id="noun1" name="noun1" required><br><br>

<label for="verb1">Verb:</label>
<input type="text" id="verb1" name="verb1" required><br><br>

<label for="adjective1">Adjective:</label>
<input type="text" id="adjective1" name="adjective1" required><br><br>

<label for="adverb1">Adverb:</label>
<input type="text" id="adverb1" name="adverb1" required><br><br>

<label for="noun2">Another Noun:</label>
<input type="text" id="noun2" name="noun2" required><br><br>

<label for="verb2">Another Verb:</label>
<input type="text" id="verb2" name="verb2" required><br><br>

<label for="adjective2">Another Adjective:</label>
<input type="text" id="adjective2" name="adjective2" required><br><br>

<label for="adverb2">Another Adverb:</label>
<input type="text" id="adverb2" name="adverb2" required><br><br>

<button type="button" onclick="generateMadLib()">Generate Mad Lib</button>
</form>

<div id="story" class="hidden">
<h2>Your Mad Libs Story</h2>
<p id="madLibStory"></p>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
22 changes: 22 additions & 0 deletions Games/Madlibs/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
function generateMadLib() {
// Get the values from the form
const noun1 = document.getElementById('noun1').value;
const verb1 = document.getElementById('verb1').value;
const adjective1 = document.getElementById('adjective1').value;
const adverb1 = document.getElementById('adverb1').value;
const noun2 = document.getElementById('noun2').value;
const verb2 = document.getElementById('verb2').value;
const adjective2 = document.getElementById('adjective2').value;
const adverb2 = document.getElementById('adverb2').value;

// Create the story
const story = `Once upon a time, there was a ${adjective1} ${noun1} that loved to ${verb1} ${adverb1}.
Every morning, it would wake up and ${verb2} with its ${adjective2} ${noun2}.
One day, they decided to go on an adventure together. They ${verb1} through the forest and ${verb2} over the mountains,
always ${adverb1} and ${adverb2}.
By the end of the day, they were tired but happy, knowing they had experienced something truly ${adjective1}.`;

// Display the story
document.getElementById('madLibStory').textContent = story;
document.getElementById('story').classList.remove('hidden');
}
63 changes: 63 additions & 0 deletions Games/Madlibs/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 20px;
display: flex;
justify-content: center;
align-items: flex-start;
min-height: 100vh;
box-sizing: border-box;
}

.container {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
max-width: 400px;
width: 100%;
}

.hidden {
display: none;
}

h1 {
margin-bottom: 20px;
}

form {
margin-bottom: 20px;
}

label {
display: block;
margin-bottom: 5px;
}

input {
width: calc(100% - 20px);
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
}

button {
padding: 10px 20px;
border: none;
background-color: #28a745;
color: white;
border-radius: 5px;
cursor: pointer;
}

button:hover {
background-color: #218838;
}

#story {
margin-top: 20px;
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ This repository also provides one such platforms where contributers come over an
| Game | Game | Game | Game | Game |


| [Master Typing](https://github.com/kunjgit/GameZone/tree/main/Games/Master_Typing) | [Treasure Hunt](https://github.com/Antiquely3059/GameZone/tree/main/Games/Treasure%20Hunt) | [Virtual Pet](https://github.com/Antiquely3059/GameZone/tree/main/Games/Virtual_Pet) | [MazeRunner](https://github.com/kunjgit/GameZone/tree/main/Games/MazeRunner) | [Ping_Pong_Singleplayer](https://github.com/kunjgit/GameZone/tree/main/Games/Ping_Pong_Singleplayer) | |
| [Master Typing](https://github.com/kunjgit/GameZone/tree/main/Games/Master_Typing) | [Treasure Hunt](https://github.com/Antiquely3059/GameZone/tree/main/Games/Treasure%20Hunt) | [Virtual Pet](https://github.com/Antiquely3059/GameZone/tree/main/Games/Virtual_Pet) | [MazeRunner](https://github.com/kunjgit/GameZone/tree/main/Games/MazeRunner) | [Ping_Pong_Singleplayer](https://github.com/kunjgit/GameZone/tree/main/Games/Ping_Pong_Singleplayer) | [Madlibs](https://github.com/AaryanManghnani/GameZone/tree/main/Games/Madlibs) |

| [Tilting Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Tilting_Maze) | [Simon Game Challenge](https://github.com/kunjgit/GameZone/tree/main/Games/Simon_Game_Challenge) | [Snake Game](https://github.com/kunjgit/GameZone/tree/main/Games/Snake_Game) | [Dino Runner Game](https://github.com/kunjgit/GameZone/tree/main/Games/Dino_Runner_Game) |
| [Whack a Mole](https://github.com/kunjgit/GameZone/tree/main/Games/Whack_a_Mole) | [Doraemon Jump](https://github.com/kunjgit/GameZone/tree/main/Games/Doraemon_Jump) | [Black Jack](https://github.com/kunjgit/GameZone/tree/main/Games/Black_Jack) | [Memory Game](https://github.com/kunjgit/GameZone/tree/main/Games/Memory_Game) | [Word Guessing Game](https://github.com/kunjgit/GameZone/tree/main/Games/Word_Guessing_Game)
Expand All @@ -129,7 +129,7 @@ This repository also provides one such platforms where contributers come over an
| [Platform Game](https://github.com/kunjgit/GameZone/tree/main/Games/Platform_Game) | [Red Light Green Light](https://github.com/kunjgit/GameZone/tree/main/Games/Red_Light_Green_Light) | [Squash your Enemy](https://github.com/kunjgit/GameZone/tree/main/Games/Squashing_your_Enemy) | [Avax Gods](https://github.com/kunjgit/GameZone/tree/main/Games/Avax_gods) | [Flip Card Game](https://github.com/kunjgit/GameZone/tree/main/Games/Flip_Card_Game) |
| [Bingo Game](https://github.com/kunjgit/GameZone/tree/main/Games/Bingo_Game) | [Fifteen Puzzle Game](https://github.com/kunjgit/GameZone/tree/main/Games/Fifteen_Puzzle_Game) | [Stack_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Stack_Game) | [Block.io_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Block.io) | [Country_Guesser_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Country_Guesser_Game) |
| [Touch_The_Ball_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Touch_The_Ball) | [Sudoku](https://github.com/kunjgit/GameZone/tree/main/Games/Sudoku) | [Mini Golf](https://github.com/kunjgit/GameZone/tree/main/Games/Mini_Golf) | [Rubik's solver](https://github.com/kunjgit/GameZone/tree/main/Games/Rubik's_solver) | [Shoot_The_Balloon](https://github.com/kunjgit/GameZone/tree/main/Games/Shoot_The_Balloon) |
| [Dont_Die_To_Ghosts](https://github.com/kunjgit/GameZone/tree/main/Games/Dont_Die_To_Ghosts) | [SciFi Alchemy](https://github.com/kunjgit/GameZone/tree/main/Games/SciFi_Alchemy) | [Packabunchas](https://github.com/kunjgit/GameZone/tree/main/Games/Packabunchas) | [Cast and Catch](https://github.com/Sheetal-05/GameZone/tree/main/Games/Cast_and_Catch) | [Track Not Found](https://github.com/kunjgit/GameZone/tree/main/Games/Track_Not_Found) |
| [Dont_Die_To_Ghosts](https://github.com/kunjgit/GameZone/tree/main/Games/Dont_Die_To_Ghosts) | [SciFi Alchemy](https://github.com/kunjgit/GameZone/tree/main/Games/SciFi_Alchemy) | [Packabunchas](https://github.com/kunjgit/GameZone/tree/main/Games/Packabunchas) | [Cast and Catch](https://github.com/Sheetal-05/GameZone/tree/main/Games/Cast_and_Catch) | [Track Not Found](https://github.com/kunjgit/GameZone/tree/main/Games/Track_Not_Found) |
| [Love Calculator Game](https://github.com/kunjgit/GameZone/tree/main/Games/Love_Calci) | [Planet Game](https://github.com/kunjgit/GameZone/tree/main/Games/Planet_Game) | [Snake Ladder](https://github.com/kunjgit/GameZone/tree/main/Games/Snake_Ladder) | [Among Us Game](https://github.com/kunjgit/GameZone/tree/main/Games/Among_Us_Game) | [Pokedex Game](https://github.com/kunjgit/GameZone/tree/main/Games/Pokedex) |
| [Pacific Air Battle](https://github.com/kunjgit/GameZone/tree/main/Games/Pacific_Air_Battle) | [Dante](https://github.com/kunjgit/GameZone/tree/main/Games/Dante) | [Ping Pong Multiplayer](https://github.com/kunjgit/GameZone/tree/main/Games/Ping_Pong_Multiplayer) | [Sonic The Hedgehog](https://github.com/kunjgit/GameZone/tree/main/Games/Sonic_The_Hedgehog) | [World Of Emojis](https://github.com/kunjgit/GameZone/tree/main/Games/World_Of_Emojis) |
| [Ball Fall Game](https://github.com/kunjgit/GameZone/tree/main/Games/Ball_Fall_Game) | [Pinball](https://github.com/kunjgit/GameZone/tree/main/Games/Pinball) | [Duck_Hunting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Duck_Hunting_Game) | [Color Turner](https://github.com/kunjgit/GameZone/tree/main/Games/Color_Turner) | [Catch the Bunny](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_the_Bunny) |
Expand Down Expand Up @@ -929,4 +929,4 @@ Terms and conditions for use, reproduction and distribution are under the [Apach
</center>
<br>

<p align="right"><a href="#top">Back to top</a></p>
<p align="right"><a href="#top">Back to top</a></p>
Binary file added assets/images/Madlibs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading