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 Language Learner Adventure #4463

Merged
merged 13 commits into from
Aug 4, 2024
51 changes: 51 additions & 0 deletions Games/Language_Learner_Adventure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ** Language Learner Adventure **


<br>

## **Description 📃**

The goal of the game is to help players learn new vocabulary by matching words with their correct translations. Players answer multiple-choice questions and receive feedback on their answers. A scoring system tracks their progress.


## **functionalities 🎮**

- The game displays a word in the target language.
- Players choose the correct translation from multiple options.
- Feedback is given for each answer, indicating whether it was correct or incorrect.
- The score increases with each correct answer.
- The game continues until all questions have been answered.
- The final score is displayed at the end.


<br>

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

- Initialization:
- Load the first question.
- Initialize the score to 0.
- Display the question and answer options.

- Answer Selection:
- When a player selects an answer, check if it is correct.
- Update the score if the answer is correct.
- Provide feedback based on the correctness of the answer.

- Next Question:
- Move to the next question when the player clicks the "Next" button.
- If there are no more questions, display the final score and end the game.

- End of Game:
- Display a message indicating the game is complete.
- Show the player's final score.

<br>

## **Screenshots 📸**

<br>

![image](../../assets/images/Language_Learner_Adventure.png)

<br>
22 changes: 22 additions & 0 deletions Games/Language_Learner_Adventure/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Language Learner Adventure</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div id="game-container">
<h1>Language Learner Adventure</h1>
<div id="score-container">Score: <span id="score">0</span></div>
<div id="question-container">
<p id="question">Translate the word: <span id="word"></span></p>
<div id="options"></div>
</div>
<button id="next-button" class="game-button">Next</button>
<p id="feedback"></p>
</div>
<script src="script.js"></script>
</body>
</html>
52 changes: 52 additions & 0 deletions Games/Language_Learner_Adventure/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
const questions = [
{ word: 'apple', correct: 'manzana', options: ['manzana', 'pera', 'plátano', 'uva'] },
{ word: 'dog', correct: 'perro', options: ['gato', 'caballo', 'perro', 'ratón'] },
{ word: 'house', correct: 'casa', options: ['edificio', 'casa', 'escuela', 'tienda'] },
{ word: 'book', correct: 'libro', options: ['revista', 'periódico', 'libro', 'cuaderno'] },
{ word: 'car', correct: 'coche', options: ['bicicleta', 'coche', 'avión', 'barco'] }
];

let currentQuestionIndex = 0;
let score = 0;

document.getElementById('next-button').addEventListener('click', nextQuestion);

function loadQuestion() {
const question = questions[currentQuestionIndex];
document.getElementById('word').innerText = question.word;
const optionsContainer = document.getElementById('options');
optionsContainer.innerHTML = '';
question.options.forEach(option => {
const button = document.createElement('button');
button.className = 'option-button';
button.innerText = option;
button.addEventListener('click', () => checkAnswer(option));
optionsContainer.appendChild(button);
});
document.getElementById('feedback').innerText = '';
}

function checkAnswer(selected) {
const question = questions[currentQuestionIndex];
if (selected === question.correct) {
score++;
document.getElementById('feedback').innerText = 'Correct!';
} else {
document.getElementById('feedback').innerText = `Incorrect! The correct answer is ${question.correct}.`;
}
document.getElementById('score').innerText = score;
}

function nextQuestion() {
currentQuestionIndex++;
if (currentQuestionIndex < questions.length) {
loadQuestion();
} else {
document.getElementById('question-container').innerHTML = '<p>You have completed the quiz!</p>';
document.getElementById('next-button').style.display = 'none';
document.getElementById('feedback').innerText = `Final Score: ${score}`;
}
}

// Initialize the first question
loadQuestion();
62 changes: 62 additions & 0 deletions Games/Language_Learner_Adventure/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
color: #333;
text-align: center;
margin: 0;
padding: 20px;
}

#game-container {
width: 80%;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 10px;
}

#question-container {
margin-bottom: 20px;
}

.game-button {
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}

#options {
display: flex;
justify-content: center;
flex-wrap: wrap;
}

.option-button {
padding: 10px 20px;
margin: 5px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #f0f0f0;
border-radius: 5px;
transition: background-color 0.3s;
}

.option-button:hover {
background-color: #e0e0e0;
}

#feedback {
margin-top: 20px;
font-size: 18px;
}

#score-container {
font-size: 20px;
margin-bottom: 20px;
}
29 changes: 4 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,29 +328,6 @@ 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)|
|[Carrom Board Game](https://github.com/kunjgit/GameZone/tree/main/Games/carrom)|
| [Number_Recall_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Recall_Game) |
ishita-43 marked this conversation as resolved.
Show resolved Hide resolved
| [Hit_the_hamster] (https://github.com/kunjgit/GameZone/tree/main/Games/Hit_the_hamster) |
| [Forest_Guardian](https://github.com/kunjgit/GameZone/tree/main/Games/Forst_Guardian) |
| [Sudoku_light_theme](https://github.com/kunjgit/GameZone/tree/main/Games/Sudoku_light_theme) |
| [Find_the_ball](https://github.com/kunjgit/GameZone/tree/main/Games/Find_the_ball) |
|[Color The Page](https://github.com/kunjgit/GameZone/tree/main/Games/Color_The_Page)|
|[AquaSort_Game](https://github.com/kunjgit/GameZone/tree/main/Games/AquaSort_Game) |
|[Chess_Game_computer](https://github.com/kunjgit/GameZone/tree/main/Games/Chess_Game_computer) |
|[Turn_on_the_light](https://github.com/kunjgit/GameZone/tree/main/Games/Turn_on_the_light) |
| [Tic-Tac-Toe Game](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-Tac-Toe) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy) |
|[Dsa_quiz_game](https://github.com/kunjgit/GameZone/tree/main/Games/Dsa_quiz_game) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy) |
| [Gravity_Simulation_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Simulation_Game) |
| [Anagarm-Word-Game](https://github.com/kunjgit/GameZone/tree/main/Games/Anagarm-Word-Game) |
| [Brick Buster Game](https://github.com/kunjgit/GameZone/tree/main/Games/Brick Buster) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
|[Penguins Cant Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Cant_Fly)|
|[GoFish](https://github.com/kunjgit/GameZone/tree/main/Games/GoFish)|
| [Taash_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Taash_Game)|

| [Intellect Quest](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Intellect_Quest) |
| [Number_Guessing_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Guessing_Game) |
| [Modulo_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Modulo_Game) |
| [Airhockey_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Airhockey_Game) |
</center>
Expand Down Expand Up @@ -782,8 +759,9 @@ This repository also provides one such platforms where contributers come over an
| [Tetris Game](https://github.com/kunjgit/GameZone/tree/main/Games/tetris_game)|
|[Chess_Game_computer](https://github.com/kunjgit/GameZone/tree/main/Games/Chess_Game_computer) |
|[Turn_on_the_light](https://github.com/kunjgit/GameZone/tree/main/Games/Turn_on_the_light) |
| [Tic-Tac-Toe Game](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-Tac-Toe) |
| [Bubble'z Popper](https://github.com/Chandu6702/GameZone/tree/main/Games/Bubble'z Popper)|
| [Tic-Tac-Toe Game](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-Tac-Toe) ||
| [Number_Guessing_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Number_Guessing_Gam)|
| [Language Learner Adventure](https://github.com/kunjgit/GameZone/tree/main/Games/Language_Learner_Adventure)|
| [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)
Expand All @@ -795,6 +773,7 @@ This repository also provides one such platforms where contributers come over an
| [Brick Buster Game](https://github.com/kunjgit/GameZone/tree/main/Games/Brick Buster) |
| [Rapid_click_frenzy](https://github.com/kunjgit/GameZone/tree/main/Games/Rapid_click_frenzy)
| [Alphabet-and-Vowels](https://github.com/kunjgit/GameZone/tree/main/Games/Alphabet-and-Vowels) |
| [Taash_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Taash_Game)|
| [Brick Buster Game](https://github.com/kunjgit/GameZone/tree/main/Games/Brick%20Buster) |
| [Penguins Can't Fly](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Penguins_Can't_Fly) |
| [Intellect Quest](https://github.com/Will2Jacks/GameZoneForked/tree/Task/Games/Intellect_Quest) |
Expand Down
Binary file added assets/images/Language_Learner_Adventure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading