diff --git a/Games/Box_In_Air_Game/README.md b/Games/Box_In_Air_Game/README.md new file mode 100644 index 0000000000..cbd329a9b9 --- /dev/null +++ b/Games/Box_In_Air_Game/README.md @@ -0,0 +1,23 @@ +# **Box_In_Air_Game** + + Bow_In_Arrow Game + +
+ + +## **functionalities 🎮** + +- Bow_In_Arrow is a game implemented using HTML, CSS, and JavaScript. The game is to shoot monsters and save birds. +
+ +## **How to play? 🕹️** + +- Start the game +- Move the man with Arrow Keys +- Shoot arrow with Space Bar +- +1 for hitting monsters +- -5 if monsters reaches birds +- Game Over if score<0 +- Monsters speed increases each level. + +
\ No newline at end of file diff --git a/Games/Box_In_Air_Game/index.html b/Games/Box_In_Air_Game/index.html new file mode 100644 index 0000000000..dec53f8ff2 --- /dev/null +++ b/Games/Box_In_Air_Game/index.html @@ -0,0 +1,22 @@ + + + + + Table Tennis Game + + + +
+
+
+
+
+
+
+ 0 + 0 +
+
+ + + diff --git a/Games/Box_In_Air_Game/script.js b/Games/Box_In_Air_Game/script.js new file mode 100644 index 0000000000..b4e47bf361 --- /dev/null +++ b/Games/Box_In_Air_Game/script.js @@ -0,0 +1,63 @@ +let ball = document.querySelector('.ball'); +let paddleLeft = document.querySelector('.paddle-left'); +let paddleRight = document.querySelector('.paddle-right'); +let player1Score = document.querySelector('#player1-score'); +let player2Score = document.querySelector('#player2-score'); + +let ballSpeedX = 4; +let ballSpeedY = 4; +let paddleSpeed = 8; + +function moveBall() { + ball.style.top = `${parseInt(ball.style.top) + ballSpeedY}px`; + ball.style.left = `${parseInt(ball.style.left) + ballSpeedX}px`; + + if (parseInt(ball.style.top) <= 0 || parseInt(ball.style.top) >= 580) { + ballSpeedY *= -1; + } + + if (parseInt(ball.style.left) <= 0 || parseInt(ball.style.left) >= 780) { + ballSpeedX *= -1; + } + if (parseInt(ball.style.left) <= 20 && parseInt(ball.style.top) >= parseInt(paddleLeft.style.top) && parseInt(ball.style.top) <= parseInt(paddleLeft.style.top) + 100) { + ballSpeedX *= -1; + } + + if (parseInt(ball.style.left) >= 760 && parseInt(ball.style.top) >= parseInt(paddleRight.style.top) && parseInt(ball.style.top) <= parseInt(paddleRight.style.top) + 100) { + ballSpeedX *= -1; + } + if (parseInt(ball.style.left) <= 0) { + player2Score.textContent = parseInt(player2Score.textContent) + 1; + resetBall(); + } + + if (parseInt(ball.style.left) >= 780) { + player1Score.textContent = parseInt(player1Score.textContent) + 1; + resetBall(); + } +} +function movePaddles(event) { + if (event.key === 'w') { + paddleLeft.style.top = `${parseInt(paddleLeft.style.top) - paddleSpeed}px`; + } + + if (event.key === 's') { + paddleLeft.style.top = `${parseInt(paddleLeft.style.top) + paddleSpeed}px`; + } + if (event.key === 'ArrowUp') { + paddleRight.style.top = `${parseInt(paddleRight.style.top) - paddleSpeed}px`; + } + + if (event.key === 'ArrowDown') { + paddleRight.style.top = `${parseInt(paddleRight.style.top) + paddleSpeed}px`; + } +} +function resetBall() { + ball.style.top = '50%'; + ball.style.left = '50%'; + ballSpeedX = 4; + ballSpeedY = 4; +} + +document.addEventListener('keydown', movePaddles); +setInterval(moveBall, 16); diff --git a/Games/Box_In_Air_Game/style.css b/Games/Box_In_Air_Game/style.css new file mode 100644 index 0000000000..db29b4eb44 --- /dev/null +++ b/Games/Box_In_Air_Game/style.css @@ -0,0 +1,48 @@ +.game-container { + width: 800px; + height: 600px; + margin: 40px auto; + background-color: #f0f0f0; +} + +.table { + width: 100%; + height: 100%; + position: relative; + background-color: #008000; +} + +.ball { + width: 20px; + height: 20px; + background-color: #fff; + border-radius: 50%; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); +} +.paddle { + width: 10px; + height: 100px; + background-color: #fff; + position: absolute; + top: 50%; + transform: translate(0, -50%); +} + +.paddle-left { + left: 10px; +} + +.paddle-right { + right: 10px; +} +.scoreboard { + position: absolute; + top: 10px; + left: 50%; + transform: translate(-50%, 0); + font-size: 24px; + font-weight: bold; +} diff --git a/README.md b/README.md index 33a81a8026..775639387f 100644 --- a/README.md +++ b/README.md @@ -600,7 +600,8 @@ This repository also provides one such platforms where contributers come over an | [Escape](https://github.com/kunjgit/GameZone/tree/main/Games/Escape) | [Retro Dungeon Puzzle](https://github.com/kunjgit/GameZone/tree/main/Games/Retro_Dungeon_Puzzle) | [Immunity Collapse](https://github.com/kunjgit/GameZone/tree/main/Games/Immunity_Collapse) | [Hunt Your Card](https://github.com/kunjgit/GameZone/tree/main/Games/Hunt_Your_Card) | [Tenacity](https://github.com/kunjgit/GameZone/tree/main/Games/Tenacity) | | [Emoji Puzzle Game](https://github.com/kunjgit/GameZone/tree/main/Games/Emoji_Puzzle_Game) | [Back To Space](https://github.com/kunjgit/GameZone/tree/main/Games/Back_To_Space) | [Snooze](https://github.com/kunjgit/GameZone/tree/main/Games/Snooze) | [Galaxy Rider](https://github.com/kunjgit/GameZone/tree/main/Games/Galaxy_Rider) | [Squared Lines](https://github.com/kunjgit/GameZone/tree/main/Games/Squared_Lines) | | [Space War](https://github.com/kunjgit/GameZone/tree/main/Games/Space_War) | [Sciara of Colors](https://github.com/kunjgit/GameZone/tree/main/Games/Sciara_Of_Colors) | [JunoJs](https://github.com/kunjgit/GameZone/tree/main/Games/JunoJs) | [Fall Down](https://github.com/kunjgit/GameZone/tree/main/Games/Fall_Down) | [Cat Goric](https://github.com/kunjgit/GameZone/tree/main/Games/Cat_Goric) | -| [Cable Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Cable_Maze) | [Spaceducts](https://github.com/kunjgit/GameZone/tree/main/Games/Spaceducts) | [Zurbo](https://github.com/kunjgit/GameZone/tree/main/Games/Zurbo) | [Blast Zone](https://github.com/kunjgit/GameZone/tree/main/Games/BlastZone) | [Free Bird](https://github.com/kunjgit/GameZone/tree/main/Games/Free_Bird) | +| [Cable Maze](https://github.com/kunjgit/GameZone/tree/main/Games/Cable_Maze) | [Spaceducts](https://github.com/kunjgit/GameZone/tree/main/Games/Spaceducts) +| [Box In Air Game](https://github.com/kunjgit/GameZone/tree/main/Games/Box_In_Air_Game) | [Zurbo](https://github.com/kunjgit/GameZone/tree/main/Games/Zurbo) | [Blast Zone](https://github.com/kunjgit/GameZone/tree/main/Games/BlastZone) | [Free Bird](https://github.com/kunjgit/GameZone/tree/main/Games/Free_Bird) | | [Maximise Boxes](https://github.com/kunjgit/GameZone/tree/main/Games/MaximiseBoxes) | [Slide Puzzle](https://github.com/kunjgit/GameZone/tree/main/Games/Slide_Puzzle) | [Diamond Run](https://github.com/kunjgit/GameZone/tree/main/Games/Diamond_Run) | [Everyones Sky](https://github.com/kunjgit/GameZone/tree/main/Games/Everyones_Sky) | [Line Of Fire](https://github.com/kunjgit/GameZone/tree/main/Games/Line_Of_Fire) | | [1024 Moves](https://github.com/kunjgit/GameZone/tree/main/Games/1024_Moves) | [Save The Forest](https://github.com/kunjgit/GameZone/tree/main/Games/Save_The_Forest) | [Dragon World Game](https://github.com/kunjgit/GameZone/tree/main/Games/Dragon_World_Game) | [DuckHunt](https://github.com/kunjgit/GameZone/tree/main/Games/DuckHunt) | [Plankman](https://github.com/kunjgit/GameZone/tree/main/Games/Plankman) | | [Hold The Cloud](https://github.com/kunjgit/GameZone/tree/main/Games/Hold_The_Cloud) | [Labyrinth](https://github.com/kunjgit/GameZone/tree/main/Games/Labyrinth) | [RIP](https://github.com/kunjgit/GameZone/tree/main/Games/RIP) | [Risky Nav](https://github.com/kunjgit/GameZone/tree/main/Games/Risky_Nav) | [Pixels From Space](https://github.com/kunjgit/GameZone/tree/main/Games/Pixels_From_Space) | diff --git a/assets/images/Box_In_Air_Game.png b/assets/images/Box_In_Air_Game.png new file mode 100644 index 0000000000..bbd6265f0b Binary files /dev/null and b/assets/images/Box_In_Air_Game.png differ diff --git a/assets/js/gamesData.json b/assets/js/gamesData.json index 25053af8d4..9747839560 100644 --- a/assets/js/gamesData.json +++ b/assets/js/gamesData.json @@ -3213,6 +3213,17 @@ "thumbnailUrl": "Sky_Lift_Dash.png" }, "643":{ + + "gameTitle" : "Droop Dash Game", + "gameUrl": "Drop_Dash_Game", + "thumbnailUrl": "Drop_Dash_Game.png" + }, + + "644":{ + "gameTitle" : "Box In Air Game", + "gameUrl": "Box_In_Air_Game", + "thumbnailUrl": "Box_In_Air_Game.png" + "gameTitle" : "Block Vault", "gameUrl": "Block_Vault", "thumbnailUrl": "Block_Vault.png" @@ -3226,5 +3237,6 @@ "gameTitle" : "Droop Dash Game", "gameUrl": "Drop_Dash_Game", "thumbnailUrl": "Drop_Dash_Game.png" + } }