diff --git a/Games/Gravity_Switch_Game/README.md b/Games/Gravity_Switch_Game/README.md new file mode 100644 index 0000000000..605a9312b5 --- /dev/null +++ b/Games/Gravity_Switch_Game/README.md @@ -0,0 +1,21 @@ +# **Gravity_Switch_Game** + +## **Description 📃** +Reach the exit (not implemented in this basic version) by navigating through the platforms using gravity switches. + +
+## **How to play? 🕹ī¸** +Controls: + +- Space bar: Switch gravity direction (up or down) +- No horizontal movement: Focus on vertical movement and gravity switching + +Gameplay: + +1. Start by falling downwards due to gravity. +2. Switch gravity direction by pressing the space bar when you're close to a platform. +3. Use the switched gravity to move upwards or downwards onto platforms. +4. Continue switching gravity to navigate through the platforms. +5. Reach the top or bottom of the game container to win (not implemented in this basic version). + +
\ No newline at end of file diff --git a/Games/Gravity_Switch_Game/index.html b/Games/Gravity_Switch_Game/index.html new file mode 100644 index 0000000000..d2f4b29f0b --- /dev/null +++ b/Games/Gravity_Switch_Game/index.html @@ -0,0 +1,14 @@ + + + + Gravity Switch + + + +
+
+
+
+ + + diff --git a/Games/Gravity_Switch_Game/script.js b/Games/Gravity_Switch_Game/script.js new file mode 100644 index 0000000000..2771e9f5d7 --- /dev/null +++ b/Games/Gravity_Switch_Game/script.js @@ -0,0 +1,23 @@ +const gameContainer = document.querySelector('.game-container'); +const player = document.querySelector('.player'); +const platforms = document.querySelector('.platforms'); + +let gravityDirection = 1; +let playerY = 50; +let playerSpeed = 4; + +function movePlayer() { + playerY += playerSpeed * gravityDirection; + player.style.top = `${playerY}px`; +} + +function switchGravity() { + gravityDirection *= -1; +} + +document.addEventListener('keydown', (event) => { + if (event.keyCode === 32) { // Space bar + switchGravity(); + } +}); +setInterval(movePlayer, 16); diff --git a/Games/Gravity_Switch_Game/style.css b/Games/Gravity_Switch_Game/style.css new file mode 100644 index 0000000000..9aaf3145f8 --- /dev/null +++ b/Games/Gravity_Switch_Game/style.css @@ -0,0 +1,29 @@ + +.game-container { + width: 800px; + height: 600px; + background-color: #000; +} + +.player { + width: 30px; + height: 30px; + background-color: #FFF; + position: absolute; +} + +.platforms { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.platform { + width: 100px; + height: 20px; + background-color: #666; + margin: 10px; + display: inline-block; +} \ No newline at end of file diff --git a/README.md b/README.md index 870fc6e5e1..7e74f29c7c 100644 --- a/README.md +++ b/README.md @@ -600,6 +600,7 @@ This repository also provides one such platforms where contributers come over an | [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) | | [Catch me game](https://github.com/kunjgit/GameZone/tree/main/Games/Catch_me_game) | [Blank Detective](https://github.com/kunjgit/GameZone/tree/main/Games/Blanks_Detective) | [Falling Blocks](https://github.com/kunjgit/GameZone/tree/main/Games/Falling_Blocks) | [Movie Guessing Game](https://github.com/kunjgit/GameZone/tree/main/Games/Movie_Guessing_Game) | [Wildcard Bonanza](https://github.com/kunjgit/GameZone/tree/main/Games/Wildcard_Bonanza) | + | [Gravity Switch Game](https://github.com/kunjgit/GameZone/tree/main/Games/Gravity_Switch_Game) | | [The Last Spartan](https://github.com/kunjgit/GameZone/tree/main/Games/The_Last_Spartan) | [Space Exploration](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Exploration) | [Bow Arrow Game](https://github.com/kunjgit/GameZone/tree/main/Games/Bow_Arrow) | [I Want To Google The Game](https://github.com/kunjgit/GameZone/tree/main/Games/I_Want_To_Google_The_Game) | [Space Gun](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Gun) | | [Space Huggers](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Huggers) | [Spaceship Escort](https://github.com/kunjgit/GameZone/tree/main/Games/Spaceship_Escort) | [Space Defence](https://github.com/kunjgit/GameZone/tree/main/Games/Space_Defence) | [Glitch Buster](https://github.com/kunjgit/GameZone/tree/main/Games/Glitch_Buster) | [3D Box Game](https://github.com/kunjgit/GameZone/tree/main/Games/3d_Box_Game) | | [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) | diff --git a/assets/images/Gravity_Switch_Game.png b/assets/images/Gravity_Switch_Game.png new file mode 100644 index 0000000000..fd567b469a Binary files /dev/null and b/assets/images/Gravity_Switch_Game.png differ diff --git a/assets/js/gamesData.json b/assets/js/gamesData.json index 772701c688..cbcb6f7714 100644 --- a/assets/js/gamesData.json +++ b/assets/js/gamesData.json @@ -3223,30 +3223,38 @@ "gameTitle" : "Box In Air Game", "gameUrl": "Box_In_Air_Game", "thumbnailUrl": "Box_In_Air_Game.png" - + }, + "645":{ "gameTitle" : "Block Vault", "gameUrl": "Block_Vault", "thumbnailUrl": "Block_Vault.png" }, - "645":{ + + + "646":{ "gameTitle" : "Harry Potter Wizard Quiz", "gameUrl": "Harry_Potter_Wizard_Quiz/start.html", "thumbnailUrl": "Harry_Potter_Wizard_Quiz.png" } - "646":{ + + "647":{ "gameTitle" : "Droop Dash Game", "gameUrl": "Drop_Dash_Game", "thumbnailUrl": "Drop_Dash_Game.png" - }, - "647":{ + }, + "648":{ + "gameTitle" : "Gravity Switch Game", + "gameUrl": "Gravity_Switch_Game", + "thumbnailUrl": "Gravity_Switch_Game.png" + + "649":{ "gameTitle" : "Random Choice Picker", "gameUrl": "Random_Choice_Picker", "thumbnailUrl": "Drop_Dash_Game.png" - } }