diff --git a/Games/King_Of_Pirates_Quiz/README.md b/Games/King_Of_Pirates_Quiz/README.md new file mode 100644 index 0000000000..e239f34954 --- /dev/null +++ b/Games/King_Of_Pirates_Quiz/README.md @@ -0,0 +1,48 @@ +# One Piece Quiz + +This is a simple quiz application based on the popular anime and manga series, One Piece. The quiz tests your knowledge of the series with a set of questions. The application is built using HTML, CSS, and JavaScript. + +## Table of Contents + +- [Project Overview](#project-overview) +- [Features](#features) +- [Technologies Used](#technologies-used) +- [Usage](#usage) +- [Contributing](#contributing) + + +## Project Overview + +The One Piece Quiz is a web application that presents the user with a series of questions related to One Piece. Each question has multiple choice answers, and the user can select the correct answer to proceed to the next question. At the end of the quiz, the user receives a score based on their answers. + +## Features + +- A series of multiple choice questions related to One Piece +- Next question button to proceed through the quiz +- Score calculation and display at the end of the quiz +- Responsive design for various screen sizes + +## Technologies Used + +- HTML +- CSS +- JavaScript +- Google Fonts + + + +## Usage + +1. Open the `index.html` file in your web browser. +2. Click the "Next Question" button to proceed through the quiz. +3. Select the correct answer for each question. +4. At the end of the quiz, view your score. + + + +## Contributing + +Contributions are welcome! If you would like to contribute to this project, please fork the repository and submit a pull request with your changes. Ensure that your code follows the existing code style and includes tests where applicable. + + + diff --git a/Games/King_Of_Pirates_Quiz/background.jpg b/Games/King_Of_Pirates_Quiz/background.jpg new file mode 100644 index 0000000000..d02228d699 Binary files /dev/null and b/Games/King_Of_Pirates_Quiz/background.jpg differ diff --git a/Games/King_Of_Pirates_Quiz/index.html b/Games/King_Of_Pirates_Quiz/index.html new file mode 100644 index 0000000000..f1a00d71dd --- /dev/null +++ b/Games/King_Of_Pirates_Quiz/index.html @@ -0,0 +1,26 @@ + + + + + +One Piece Quiz + + + + + + +
+

One Piece Quiz

+ +
+ +
+ +
+ +
+
+ + + diff --git a/Games/King_Of_Pirates_Quiz/script.js b/Games/King_Of_Pirates_Quiz/script.js new file mode 100644 index 0000000000..790d14e68f --- /dev/null +++ b/Games/King_Of_Pirates_Quiz/script.js @@ -0,0 +1,206 @@ +const questions = [ + { + question: "Who is the captain of the Straw Hat Pirates?", + answers: ["Luffy", "Zoro", "Sanji", "Nami"], + correctAnswer: "Luffy" + }, + { + question: "What is the name of Luffy's signature attack?", + answers: ["Gum-Gum Pistol", "Gum-Gum Bazooka", "Gum-Gum Gatling", "Gum-Gum Red Hawk"], + correctAnswer: "Gum-Gum Gatling" + }, + { + question: "Who is known as the 'Pirate Hunter'?", + answers: ["Luffy", "Zoro", "Sanji", "Nami"], + correctAnswer: "Zoro" + }, + { + question: "Who is known as the 'King of the Pirates'?", + answers: ["Shanks", "Whitebeard", "Roger", "Kaido"], + correctAnswer: "Roger" + + }, + { + question: "What is the name of the Devil Fruit that Luffy eats?", + answers: ["Gum-Gum Fruit", "Fire-Fire Fruit", "Ice-Ice Fruit", "Dark-Dark Fruit"], + correctAnswer: "Gum-Gum Fruit" + + }, + { + question: "Who is Luffy's adoptive brother?", + answers: ["Zoro", "Ace", "Sanji", "Law"], + correctAnswer: "Ace" + + }, + + + { + question: "What is the name of Luffy's ship?", + answers: ["Polar Tang", "Going Merry", "Moby Dick", "Red Force"], + correctAnswer: "Going Merry" + + }, + { + question: "What is Zoro's dream?", + answers: ["To become the greatest swordsman", "To find the One Piece", "To become a famous chef", "To become a doctor"], + correctAnswer: "To become the greatest swordsman" + + }, + { + question: "Who is the creator of the One Piece manga and anime series?", + answers: ["Eiichiro Oda", "Akira Toriyama", "Masashi Kishimoto", "Tite Kubo"], + correctAnswer: "Eiichiro Oda" + + }, + { + question: "Who is the doctor of the Straw Hat Pirates?", + answers: ["Chopper", "Law", "Franky", "Brook"], + correctAnswer: "Chopper" + }, + { + question: "What is the name of the island where Luffy first meets the Warlord Dracule Mihawk?", + answers: ["Water 7", "Loguetown", "Sabaody Archipelago", "Baratie"], + correctAnswer: "Baratie" + + }, + + { + question: "Which character has the highest known bounty in the One Piece series?", + answers: ["Monkey D. Luffy", "Charlotte Katakuri", "Edward Newgate (Whitebeard)", "Marshall D. Teach (Blackbeard)"], + correctAnswer: "Edward Newgate (Whitebeard)" + + }, + + { + question: "Who is the original owner of the Straw Hat that Luffy wears?", + answers: ["Gol D. Roger", "Shanks", "Rayleigh", "Whitebeard"], + correctAnswer: "Gol D. Roger" + }, + { + question: "What is the name of the island where the One Piece treasure is said to be located?", + answers: ["Skypiea", "Raftel", "Wano", "Elbaf"], + correctAnswer: "Raftel" + }, + { + question: "Which character can transform into a dragon?", + answers: ["Marco", "Kaido", "Law", "Kin'emon"], + correctAnswer: "Kaido" + }, + { + question: "What is the name of Luffy's first bounty poster?", + answers: ["30,000,000 Berries", "100,000,000 Berries", "1,000,000 Berries", "10,000,000 Berries"], + correctAnswer: "30,000,000 Berries" + }, + { + question: "Who is the captain of the Heart Pirates?", + answers: ["Trafalgar Law", "Eustass Kid", "X Drake", "Killer"], + correctAnswer: "Trafalgar Law" + }, + { + question: "What is the name of the special technique used by Zoro, where he creates multiple sword illusions?", + answers: ["Oni Giri", "Tatsumaki", "Santoryu Ogi: Sanzen Sekai", "Asura"], + correctAnswer: "Santoryu Ogi: Sanzen Sekai" + }, + { + question: "Who was the first character to defeat Luffy in a one-on-one fight?", + answers: ["Crocodile", "Arlong", "Enel", "Mihawk"], + correctAnswer: "Crocodile" + }, + { + question: "What is the name of Sanji's family of assassins?", + answers: ["Baroque Works", "Big Mom Pirates", "Germa 66", "Beasts Pirates"], + correctAnswer: "Germa 66" + }, + { + question: "Which character is known as the 'Magician'?", + answers: ["Buggy", "Blackbeard", "Kizaru", "Magellan"], + correctAnswer: "Magellan" + }, + { + question: "Who is the current Fleet Admiral of the Marines?", + answers: ["Sengoku", "Aokiji", "Akainu", "Kizaru"], + correctAnswer: "Akainu" + }, + { + question: "What is the name of the Devil Fruit eaten by Trafalgar Law?", + answers: ["Op-Op Fruit", "Soul-Soul Fruit", "Room-Room Fruit", "Ope-Ope Fruit"], + correctAnswer: "Ope-Ope Fruit" + }, + { + question: "Who is the captain of the Blackbeard Pirates?", + answers: ["Blackbeard", "Shiryu", "Burgess", "Van Augur"], + correctAnswer: "Blackbeard" + }, + { + question: "What is the name of the weapon used by Franky after the timeskip?", + answers: ["Coup de Vent", "General Cannon", "Iron Pirate General Franky", "Franky Radical Beam"], + correctAnswer: "Iron Pirate General Franky" + } + +]; +let currentQuestion = 0; +let score = 0; +let wrongAnswers = []; + +const questionContainer = document.getElementById('question-container'); +const nextButton = document.getElementById('next-btn'); +const resultContainer = document.getElementById('result'); + +function displayQuestion() { + const currentQ = questions[currentQuestion]; + questionContainer.innerHTML = ` +

${currentQ.question}

+ + `; +} + +function checkAnswer() { + const selectedAnswer = document.querySelector('input[name="answer"]:checked'); + if (!selectedAnswer) return; + + if (selectedAnswer.value === questions[currentQuestion].correctAnswer) { + score++; + } else { + wrongAnswers.push({ + question: questions[currentQuestion].question, + correctAnswer: questions[currentQuestion].correctAnswer, + userAnswer: selectedAnswer.value + }); + } + + currentQuestion++; + selectedAnswer.checked = false; + + if (currentQuestion < questions.length) { + displayQuestion(); + } else { + showResult(); + } +} + +function showResult() { + questionContainer.innerHTML = ''; + nextButton.style.display = 'none'; + + resultContainer.innerHTML = `

Your Score: ${score}/${questions.length}

`; + if (wrongAnswers.length > 0) { + resultContainer.innerHTML += '

Incorrect Answers:

'; + wrongAnswers.forEach(wrong => { + resultContainer.innerHTML += ` +

Question: ${wrong.question}

+

Your Answer: ${wrong.userAnswer}

+

Correct Answer: ${wrong.correctAnswer}

+ `; + }); + } +} + +displayQuestion(); + +nextButton.addEventListener('click', function() { + this.classList.add('button-clicked'); + checkAnswer(); +}); + \ No newline at end of file diff --git a/Games/King_Of_Pirates_Quiz/styles.css b/Games/King_Of_Pirates_Quiz/styles.css new file mode 100644 index 0000000000..a60606197d --- /dev/null +++ b/Games/King_Of_Pirates_Quiz/styles.css @@ -0,0 +1,43 @@ +body { + font-family: Arial, sans-serif; + + } + .heading-container{ + font-family: "Press Start 2P", system-ui; + font-weight: 400; + font-style: normal; + align-self: center; + margin-left: 27%; + font-size: 30px; + + } + + .quiz-container { + max-width: 600px; + margin: 20px auto; + padding: 20px; + border: 1px solid #ccc; + border-radius: 5px; + background-color: rgba(255, 255, 255, 0.7); + margin-top: 225px; + align-items: center; + font-family: "Press Start 2P", system-ui; + font-weight: 400; + font-style: normal; + } + + button { + padding: 10px 20px; + margin-top: 10px; + cursor: pointer; + font-family: "Press Start 2P", system-ui; + font-weight: 400; + font-style: normal; + background-color: #23407b;; + } + + button:hover { + background-color: #e48d30; + color: #080808; + } + \ No newline at end of file diff --git a/README.md b/README.md index fd48417567..55b9c2a6d0 100644 --- a/README.md +++ b/README.md @@ -369,6 +369,7 @@ This repository also provides one such platforms where contributers come over an | [IKnowYou-Mind-Reading-Game](https://github.com/kunjgit/GameZone/tree/main/Games/IKnowYou-Mind-Reading-Game) | |[Rock_Paper_Scissors_Neon](https://github.com/kunjgit/GameZone/tree/main/Games/Rock_Paper_Scissors_Neon)| |[Beat_a_mole](https://github.com/kunjgit/GameZone/tree/main/Games/Beat_a_mole)| +|[King_Of_Pirates_Quiz](https://github.com/kunjgit/GameZone/tree/main/Games/King_Of_Pirates_Quiz)| |[Catch Him](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_him) | |[Hexsweep_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Hexsweep-Game)| diff --git a/assets/images/King_Of_Pirates.jpg b/assets/images/King_Of_Pirates.jpg new file mode 100644 index 0000000000..d02228d699 Binary files /dev/null and b/assets/images/King_Of_Pirates.jpg differ