diff --git a/Games/Flying_Fish/README.md b/Games/Flying_Fish/README.md new file mode 100644 index 0000000000..94825e4f49 --- /dev/null +++ b/Games/Flying_Fish/README.md @@ -0,0 +1,28 @@ +# *Game_Name* +Flying Fish + +--- + +
+ +## *Description 📃* +Flying Fish is an exhilarating game where players guide a fish through airborne obstacles using precise taps. Collect power-ups and avoid hazards to achieve the highest score. + +## *Functionalities 🎮* + +1. Click the "Start Game" button to begin. +2. Guide the fish through airborne obstacles. +3. Collect power-ups and avoid hazards. +4. Monitor the score and remaining lives. +5. When all lives are lost, the game ends, showing your final score and a button to restart the game. + +1. Controls: Use the spacebar to make the fish jump. +2. Scoring: Each power-up collected increases your score by 10 points. +3. Difficulty: As the game progresses, obstacles become more frequent and move faster. +4. Timer: Players start with 3 lives. Hitting an obstacle deducts a life. +5. Game Over: When all lives are lost, the final score is displayed with an option to play again. + +
+ +## *Screenshots 📸* +![Flying_Fish](https://github.com/user-attachments/assets/abcd778b-f8c1-4670-ac23-70e6f6373c5f) diff --git a/Games/Flying_Fish/index.html b/Games/Flying_Fish/index.html new file mode 100644 index 0000000000..580051593e --- /dev/null +++ b/Games/Flying_Fish/index.html @@ -0,0 +1,19 @@ + + + + + + Flying Fish + + + +
+
+
+
Score: 0
+
+ +
+ + + \ No newline at end of file diff --git a/Games/Flying_Fish/script.js b/Games/Flying_Fish/script.js new file mode 100644 index 0000000000..546879b5d8 --- /dev/null +++ b/Games/Flying_Fish/script.js @@ -0,0 +1,85 @@ +const fish = document.getElementById('fish'); +const game = document.getElementById('game'); +const scoreDisplay = document.getElementById('score'); +const startButton = document.getElementById('startButton'); + +let fishTop = fish.offsetTop; +let fishLeft = fish.offsetLeft; +let gameHeight = game.clientHeight; +let gameWidth = game.clientWidth; +let score = 0; +let gameInterval; +let isGameRunning = false; + +startButton.addEventListener('click', startGame); + +function startGame() { + isGameRunning = true; + score = 0; + scoreDisplay.textContent = 'Score: ' + score; + fishTop = gameHeight / 2; + fishLeft = 50; + fish.style.top = fishTop + 'px'; + fish.style.left = fishLeft + 'px'; + startButton.style.display = 'none'; + gameInterval = setInterval(gameLoop, 20); + document.addEventListener('keydown', controlFish); +} + +function gameLoop() { + if (!isGameRunning) return; + + // Gravity + fishTop += 2; + fish.style.top = fishTop + 'px'; + + // Check for collision with bottom of the game area + if (fishTop > gameHeight - fish.clientHeight) { + endGame(); + } + + // Increase score + score++; + scoreDisplay.textContent = 'Score: ' + score; +} + +function controlFish(event) { + switch (event.code) { + case 'ArrowUp': + fishTop -= 20; + if (fishTop < 0) { + fishTop = 0; + } + fish.style.top = fishTop + 'px'; + break; + case 'ArrowDown': + fishTop += 20; + if (fishTop > gameHeight - fish.clientHeight) { + fishTop = gameHeight - fish.clientHeight; + } + fish.style.top = fishTop + 'px'; + break; + case 'ArrowLeft': + fishLeft -= 20; + if (fishLeft < 0) { + fishLeft = 0; + } + fish.style.left = fishLeft + 'px'; + break; + case 'ArrowRight': + fishLeft += 20; + if (fishLeft > gameWidth - fish.clientWidth) { + fishLeft = gameWidth - fish.clientWidth; + } + fish.style.left = fishLeft + 'px'; + break; + } +} + +function endGame() { + isGameRunning = false; + clearInterval(gameInterval); + document.removeEventListener('keydown', controlFish); + startButton.textContent = 'Restart Game'; + startButton.style.display = 'block'; +} \ No newline at end of file diff --git a/Games/Flying_Fish/styles.css b/Games/Flying_Fish/styles.css new file mode 100644 index 0000000000..99e4eb0bbf --- /dev/null +++ b/Games/Flying_Fish/styles.css @@ -0,0 +1,56 @@ +body { + margin: 0; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + background-color: #000; + color: #0ff; + font-family: 'Courier New', Courier, monospace; +} + +.game-container { + text-align: center; +} + +#game { + position: relative; + width: 300px; + height: 500px; + border: 2px solid #0ff; + overflow: hidden; + background-color: #111; +} + +#fish { + position: absolute; + width: 30px; + height: 30px; + background-color: #0ff; + border-radius: 50%; + top: 50%; + left: 50px; + transform: translateY(-50%); +} + +#score { + position: absolute; + top: 10px; + left: 10px; + font-size: 20px; +} + +#startButton { + margin-top: 20px; + padding: 10px 20px; + background-color: #0ff; + border: none; + color: #000; + font-size: 16px; + cursor: pointer; + border-radius: 5px; +} + +#startButton:hover { + background-color: #0aa; +} \ No newline at end of file diff --git a/README.md b/README.md index 7dd3d46bd4..a7a0a6a404 100644 --- a/README.md +++ b/README.md @@ -882,7 +882,7 @@ This repository also provides one such platforms where contributers come over an |[Samurai_Fighting_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Samurai_Fighting_Game)| [Tic-tac-toe](https://github.com/kunjgit/GameZone/tree/main/Games/Tic-tac-toe)| [Quest_For_Riches](https://github.com/kunjgit/GameZone/tree/main/Games/Quest_For_Riches)| [Pattern Creation Game](https://github.com/kunjgit/GameZone/tree/main/Games/Pattern_Creation_Game)| [Magic_8_ball_Game](https://github.com/kunjgit/GameZone/tree/main/Games/Magic_8_ball) | | [Catch_Craze](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_Craze) | [UNO game with computer](https://github.com/kunjgit/GameZone/tree/main/Games/UNO_game_with_Computer) | [Dice_Rolling_Simulator](https://github.com/priyashuu/GameZone/tree/main/Games/Dice_rolling_simulator)| [Space_Dominators](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Dominators)| [Simon_Says](https://github.com/kunjgit/GameZone/tree/main/Games/Simon_Says) | -|[Idle_miner](https://github.com/kunjgit/GameZone/tree/main/Games/Idle_miner)| [Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys) | [Penalty_Shootout_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Penalty_Shootout_Game)| | [Circuit_Craze](https://github.com/kunjgit/GameZone/tree/main/Games/Circuit_Craze) | +|[Idle_miner](https://github.com/kunjgit/GameZone/tree/main/Games/Idle_miner)| [Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys) | [Penalty_Shootout_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Penalty_Shootout_Game)| | [Circuit_Craze](https://github.com/kunjgit/GameZone/tree/main/Games/Circuit_Craze) | | [Flying_Fish](https://github.com/kunjgit/GameZone/tree/main/Games/Flying_Fish) | |[Idle_miner](https://github.com/kunjgit/GameZone/tree/main/Games/Idle_miner)| [Five_Nights_at_Freddys](https://github.com/kunjgit/GameZone/tree/main/Games/Five_Nights_at_Freddys) | [Penalty_Shootout_Game] (https://github.com/kunjgit/GameZone/tree/main/Games/Penalty_Shootout_Game)| |[Snake_Gun_Water](https://github.com/kunjgit/GameZone/tree/main/Games/Snake_Gun_Water)| | [Drum_kit] (https://github.com/kunjgit/GameZone/tree/main/Games/Drum_kit)| diff --git a/assets/images/Flying_Fish.png b/assets/images/Flying_Fish.png new file mode 100644 index 0000000000..1160056c56 Binary files /dev/null and b/assets/images/Flying_Fish.png differ