From cab1d107b6c33ea91f9e362272bc73081c2e95e7 Mon Sep 17 00:00:00 2001 From: Ishita Mukherjee Date: Sat, 10 Aug 2024 16:50:41 +0530 Subject: [PATCH] Gravity Switch Game is added --- Games/Gravity_Switch_Game/README.md | 21 +++++++++++++++++++ Games/Gravity_Switch_Game/index.html | 14 +++++++++++++ Games/Gravity_Switch_Game/script.js | 23 ++++++++++++++++++++ Games/Gravity_Switch_Game/style.css | 29 ++++++++++++++++++++++++++ README.md | 1 + assets/images/Gravity_Switch_Game.png | Bin 0 -> 15332 bytes assets/js/gamesData.json | 13 +++++++++--- 7 files changed, 98 insertions(+), 3 deletions(-) create mode 100644 Games/Gravity_Switch_Game/README.md create mode 100644 Games/Gravity_Switch_Game/index.html create mode 100644 Games/Gravity_Switch_Game/script.js create mode 100644 Games/Gravity_Switch_Game/style.css create mode 100644 assets/images/Gravity_Switch_Game.png 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 c4e1c4fba4..02c2fc9380 100644 --- a/README.md +++ b/README.md @@ -592,6 +592,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 0000000000000000000000000000000000000000..fd567b469a9dcea3d9c86fb33eb349f5f0f1c7d6 GIT binary patch literal 15332 zcmeHNZFCyfnN~M#(r%h$v)$9IUD;~mCSKQ(R7a~M2m!~56FGHax^fh)B_Z1N2X>IG zN@I*+fN7g<)6_PK{2|#2Fq_zpR*}VQj1WRXOuK1}By6Vou*L$xB*ADbA($WpBN&ER z!-xw zujKs{l0v%3m+pT4qhG%D^}Bo}^; zab17xG-kt$cqv?#mzU`Zp=({l|GP$NJVyD6gf%bt-`gSSB8rhOek6P8vo*h6^N}?l zS@V(qy^pLFXlpfU-Wmk|pCL%aAeP`*3QA8B+%g@8MY`E4{MZJ^C82Ki6t;Z~YWnb| zC?w)iS5AOeeRP&!>uVP#l6~CL``XM(j1;j;?qWP!)qEv^jB3^~lVXvdAttOMtx4W0 zVxWySX>!J+5HT+>vT&^FFdF6Bl6+UDB?6`6Ft-eNy5f#B1lU*}b-E|>{)up3C7jII z4|1K1dpN+TIZZF^IEHKH-`++$s#C8qpeM8*z{agte^-pW-XopW^0S?sE1`ZN?e8Jk z^Gh+O11XNrlI)a->Dk7ObSh(hkx3E#_0X=lovp|R#YmKVg(y!@3V5)~0Gu;0 z8Pnc5OyEq437L8DeX2Cdj58n>pOSHIMHI7mw~K4}eN+ejTcCjYR6yc`^AMK0LWka` z!t^k-zTP}2wGNNX9Jm2?_M;A%!|M>gVD7v#FxeHWDW=n1bV>)adntJonI;p*ua!5> zpZ+jFsq5Xc-s5S7C#Xj3Sh|eV>Ip!0J;;RBCVU91#pg>MwEZDea}I(QC)-HzJHJr zhQywywIz?U=Ki7!*$Z^(VzLgKyeJ7;HX{ENjmu0@X%$}(z~x^ z!v)3+TC1kGHgU|}p;=bSUd8H+7q!m$GW-~=jiB}Jp=ja>Zmg#e*xz$qDcSQ& z&5cxZaTMU!qr#vRVM-qd0tg+h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nnKsh{JM7+in@8igUh5VVy-JlVvUhuWEpi^e1 zV2*3UxFPY}LgJ&nyFs_YGbzWKZO^#0`X+RWE~}wcl87>im`It#7_24iWyyGE=vcYd z)Z#0XUNe$@p=4`qIK1f7@jT^p4IPKrr4H(q6p%>SMBF@7O|aSLL>x-|68SUeP4S8M z?tN_DTaHYk0QF8oH)`v7jL~e|!O%=gV&e{ae5r&gslfk8 zsGDg9STT`ojq)y~NJaZ(pv4$BKo18B>D&1<&-n$R(8Mk#p&HNL#I7^+K!=5uXSNlE z%x7ApL&->vR^$Dij%HG26MLU5stxxL;QzoWSfyhe*?lIiE(kX0H%TUniQf)+$b6VQ z_5pel&VWn0nRrUGY|HKoXw6Ezd_$_3kojj|(c8w=gXorR5$n>D+Oz^Bl zVYC>M?O{U~er8q2jF;eEs*Mti`tFS9=_y5al|Xy(AAZ*pi%fn&p+0e6Z~VZlDiAr- zf6~1==l;8UfFIb&sY0*KH6C;ZjAY!gG<=a0H%Uk{bk2taYjB-WG(kcu6gNS^85WHj zg}JVlVITSHO!fXPY&O?<2XfoHWoPwFr4S2ihAWBw0+B8=&wb_Sx89sR^)GVQ>c6F4 Oe17*1^Rqwt`F{aowu+zt literal 0 HcmV?d00001 diff --git a/assets/js/gamesData.json b/assets/js/gamesData.json index 821d6f1a37..c573ee4943 100644 --- a/assets/js/gamesData.json +++ b/assets/js/gamesData.json @@ -3223,15 +3223,22 @@ "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" - } - "643":{ + }, + "646":{ "gameTitle" : "Droop Dash Game", "gameUrl": "Drop_Dash_Game", "thumbnailUrl": "Drop_Dash_Game.png" + }, + "647":{ + "gameTitle" : "Gravity Switch Game", + "gameUrl": "Gravity_Switch_Game", + "thumbnailUrl": "Gravity_Switch_Game.png" + } }