From 40f53c7bf71bddaadc43914a09cb030a0e35bae5 Mon Sep 17 00:00:00 2001 From: Durgesh kumar prajapati <98798977+Durgesh4993@users.noreply.github.com> Date: Thu, 10 Aug 2023 19:09:11 +0530 Subject: [PATCH] Revert "Dropkick Odyssey game added - GSSOC'23" --- README.md | 1 - .../Banner - image/Dropkick_Odyssey.png | Bin 4104 -> 0 bytes .../Dropkick_Odyssey/README.md | 50 -- .../Screenshots/Dropkick_Odyssey.png | Bin 4104 -> 0 bytes .../Dropkick_Odyssey/assets/css/reset.css | 48 -- .../Dropkick_Odyssey/assets/css/style.css | 81 --- .../assets/images/keyboard-key-arrow-up.svg | 4 - .../images/keyboard-key-pointing-to-right.svg | 4 - .../left-arrow-variant-key-on-keyboard.svg | 4 - .../Dropkick_Odyssey/index.html | 63 --- .../Dropkick_Odyssey/javascript/Component.js | 34 -- .../Dropkick_Odyssey/javascript/Enemy.js | 73 --- .../Dropkick_Odyssey/javascript/Player.js | 359 -------------- .../Dropkick_Odyssey/javascript/helperObj.js | 24 - .../Dropkick_Odyssey/javascript/main.js | 461 ------------------ additionalpage/game.html | 52 -- 16 files changed, 1258 deletions(-) delete mode 100644 SinglePlayer - Games/Banner - image/Dropkick_Odyssey.png delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/README.md delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/Screenshots/Dropkick_Odyssey.png delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/assets/css/reset.css delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/assets/css/style.css delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/assets/images/keyboard-key-arrow-up.svg delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/assets/images/keyboard-key-pointing-to-right.svg delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/assets/images/left-arrow-variant-key-on-keyboard.svg delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/index.html delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/javascript/Component.js delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/javascript/Enemy.js delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/javascript/Player.js delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/javascript/helperObj.js delete mode 100644 SinglePlayer - Games/Dropkick_Odyssey/javascript/main.js diff --git a/README.md b/README.md index 3d868a3b..7ab6a2b4 100644 --- a/README.md +++ b/README.md @@ -249,7 +249,6 @@ ________________________________________________________________________________ | 184 | [Ball Jumper Game](.SinglePlayer%20-%20Games/Ball_Jumper_Game) | | 185 | [Math Sprint Game](.SinglePlayer%20-%20Games/Math_Sprint_Game) | | 186 | [Quick Type](.SinglePlayer%20-%20Games/QuickType) | -| 186 | [Dropkick Odyssey](.SinglePlayer%20-%20Games/Dropkick_Odyssey) | diff --git a/SinglePlayer - Games/Banner - image/Dropkick_Odyssey.png b/SinglePlayer - Games/Banner - image/Dropkick_Odyssey.png deleted file mode 100644 index 2e4125574f0c277bbd696e2724e5f85051766b66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4104 zcmds4`&Uy}7Cte&i-vYu7#=Om0K;;$MMaScNl?ImJVJpMkP13NfI>(l!9WlRIu<*W z$I{`AWEccy0fLGFodAggf{P`=$eT!#+6sX{B99PA2$>US{s3KzncChT&b{Zc?m1`g z@B8-N-vtNZcA8k3004IS`Fe){fP4%9;<1qd9Jw~wvj@KPD98N5jNo&@DE2DsTT*=@ zsG%eRm3AgI4#cOBh;g4%&Zfr2rBD(`R5_A^0RUCu=Y2FRy=rk9e|1KAw0}wIvhswv z&{CP7U%BP?US#7>;)k9un3se7qjoR)n4!~+zCcBL7=2XZ-Fw+kS~roG`}<2z^Fo@g zrkm+KG`qd^-Az}=$k6N0uC-74xwf&dPnXZm{_f#tcNb;DJRWVUGkRZcj);lcYdVx! zEplJ1oV-rctNr3oL7F+G2bE)_AGZ0;}p~ zV@&`9X2kM5oY=I17|R=TrgFI|`iucFukUmxU^* zzH@IDhjL3`a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alities** - -- Player Movement: Allow the player character to move left and right using the arrow keys. Implement smooth and responsive movement mechanics to navigate the game world. - -- Jump Mechanic: Create a jumping mechanism that enables the player to jump over gaps, obstacles, and enemies using the up arrow key. Incorporate variable jump height based on how long the jump key is held. - -- Dropkick Action: Implement a dropkick move triggered by pressing the left Ctrl key. Define the dropkick behavior, including its animation, damage to enemies, and interaction with obstacles. - -- Obstacle Interaction: Design interactions between the player and various obstacles, such as the yellow boxes. Ensure that collision detection is accurate, causing the player to lose a life upon contact. - -- Enemy Behavior: Develop enemy AI patterns that dictate their movement and attacks. Enemies should respond to the player's actions, such as pursuing the player or attacking when in range. - -
- -## **How to play?** - -- Your primary goal is to employ well-timed dropkicks to clear obstacles and neutralize adversaries. -- Movement: Utilize the Left Arrow Key to move left and the Right Arrow Key to move right. -- Jump: Propel your character over obstacles and gaps by pressing the Up Arrow Key. -- Dropkick Maneuver: Initiate a dropkick by pressing the Left Ctrl key. Strategically execute this move to vanquish enemies and surmount challenges. -- Yellow Box Caution: Exercise caution and skill to avoid making contact with the perilous yellow box obstacles. Colliding with these obstacles will result in your character losing a life. - -
- -## **Installation** -1. Clone or download the repository. -2. Open the index.html file in a web browser. - - -
- -## **Screenshots 📸** - -
-Game Screenshot - - - -
- - diff --git a/SinglePlayer - Games/Dropkick_Odyssey/Screenshots/Dropkick_Odyssey.png b/SinglePlayer - Games/Dropkick_Odyssey/Screenshots/Dropkick_Odyssey.png deleted file mode 100644 index 2e4125574f0c277bbd696e2724e5f85051766b66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4104 zcmds4`&Uy}7Cte&i-vYu7#=Om0K;;$MMaScNl?ImJVJpMkP13NfI>(l!9WlRIu<*W z$I{`AWEccy0fLGFodAggf{P`=$eT!#+6sX{B99PA2$>US{s3KzncChT&b{Zc?m1`g z@B8-N-vtNZcA8k3004IS`Fe){fP4%9;<1qd9Jw~wvj@KPD98N5jNo&@DE2DsTT*=@ zsG%eRm3AgI4#cOBh;g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yNOejI~H()HH5S^*%Jg1GmK*y9q4e)+z0*I zScNw%E5!F-y&bW2X(6yNM}-$UpWDoAWU=q*2UWCsu*ZJnq_#{ZPbrf)>zi{~oIim6 z>z)Sb0(@AuD_yTDSWp_S9&g~m2+B2{eLJVU2F(OMZ=O@BD5ytrl+rdN#}NQEbbJ2* zD-wP8pU;FsVU9?>FyB0g{O4n1gi!Zs36<@CqhtI;!^~j~k4$S^D`9UeY`GE|O5F_s!^;bniWy5xbIqzt z_T - - - diff --git a/SinglePlayer - Games/Dropkick_Odyssey/assets/images/keyboard-key-pointing-to-right.svg b/SinglePlayer - Games/Dropkick_Odyssey/assets/images/keyboard-key-pointing-to-right.svg deleted file mode 100644 index a4466e3d..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/assets/images/keyboard-key-pointing-to-right.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/SinglePlayer - Games/Dropkick_Odyssey/assets/images/left-arrow-variant-key-on-keyboard.svg b/SinglePlayer - Games/Dropkick_Odyssey/assets/images/left-arrow-variant-key-on-keyboard.svg deleted file mode 100644 index 8571354b..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/assets/images/left-arrow-variant-key-on-keyboard.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/SinglePlayer - Games/Dropkick_Odyssey/index.html b/SinglePlayer - Games/Dropkick_Odyssey/index.html deleted file mode 100644 index ae4f5bae..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/index.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - Game | DKM - - - - - -
-
-

how to play

-
    -
  • - keyboard left arrow - move left -
  • -
  • - keyboard right arrow - move right -
  • -
  • - keyboard right arrow - Jump! -
  • -
  • - ctrl - - Attack with a
    - Dropkick! - -
    -
  • -
-
-
- press space keyto continue -
-
-
-

Instructions:

-
    -
  • 1) avoid contact
  • -

  • -
  • 2) DROPKICK everything
    in your way
  • -

  • -
  • 3) DROPKICK the boss
    to win
  • -
-
-
-
- -
- - - - - - - \ No newline at end of file diff --git a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Component.js b/SinglePlayer - Games/Dropkick_Odyssey/javascript/Component.js deleted file mode 100644 index a6a74ad1..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Component.js +++ /dev/null @@ -1,34 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -class Component { - constructor(context, posX, posY, width, height, color) { - this.c = context; - this.width = width; - this.height = height; - this.posX = posX; - this.posY = posY; - this.color = color; - } - - draw() { - this.c.fillStyle = this.color; - this.c.fillRect(this.posX, this.posY, this.width, this.height); - } - - _leftCompHb() { - return this.posX; - } - - _rightCompHb() { - return this.posX + this.width; - } - - // talvez nao precise e eu nao tenho certeza se esta certo - _topCompHb() { - return this.posY; - } - - // talvez nao precise e eu nao tenho certeza se esta certo - _botCompHb() { - return this.posY + this.height; - } -} diff --git a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Enemy.js b/SinglePlayer - Games/Dropkick_Odyssey/javascript/Enemy.js deleted file mode 100644 index ae867d52..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Enemy.js +++ /dev/null @@ -1,73 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -class Enemy extends Component { - constructor( - context, - posX, - posY, - width, - height, - color, - isFinalBoss = false, - ) { - super(); - this.c = context; - this.width = width; - this.height = height; - this.posX = posX; - this.posY = posY; - this.color = color; - this.isFinalBoss = isFinalBoss; - - this.velocityX = 0.08; // tweak it. - this.velocityY = 0.4; - } - - move(delta) { - this.posX -= this.velocityX * delta; - if (this.posX >= element.width - this.width || this.posX <= 0) { - this.velocityX = -this.velocityX - } - } - - bigbossMove() { - const generateRandomNumberInArr = (min, max) => {return Math.random() * (max - min) + min} - const randomNumber = generateRandomNumberInArr(1, 100); - if (randomNumber >= 80) { - this.posX -= this.velocityX * delta; - if (this.posX >= element.width - this.width || this.posX <= 0) { - this.velocityX = -this.velocityX - } - } - } - - fall(deltaValue) { - this.velocityY = 0.3; - this.posY += this.velocityY * deltaValue; - } - - // *** PLAYER HITBOX *** - _isRightCompBorderCollided(enemy) { - return this._rightCompHb() >= enemy._leftCompHb(); - } - - _isLeftCompBorderCollided(enemy) { - return this._leftCompHb() <= enemy._rightCompHb(); - } - - _isTopCompBorderCollided(enemy) { - return this._topCompHb() <= enemy._botCompHb(); - } - - _isBottomCompBorderCollided(enemy) { - return this._botCompHb() >= enemy._topCompHb(); - } - - isHitTaken(enemy) { - return ( - this._isRightCompBorderCollided(enemy) && - this._isLeftCompBorderCollided(enemy) && - this._isTopCompBorderCollided(enemy) && - this._isBottomCompBorderCollided(enemy) - ); - } -} diff --git a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Player.js b/SinglePlayer - Games/Dropkick_Odyssey/javascript/Player.js deleted file mode 100644 index 4f12c05f..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/javascript/Player.js +++ /dev/null @@ -1,359 +0,0 @@ -/* eslint-disable no-underscore-dangle */ -class Player extends Component { - constructor( - context, - posX, - posY, - width, - height, - color, - horizontalLimit, - facingDirection = 'right' - ) { - super(); - this.c = context; - this.width = width; - this.height = height; - this.posX = posX; - this.posY = posY; - this.color = color; - this.horizontalLimit = horizontalLimit; - - this.facingDirection = facingDirection; - this.isAttacking = false; - this.velocityX = 0.0; // - this.velocityY = 0.4; - } - - drawSetup(color = this.color, direction = this.facingDirection) { - this.c.fillStyle = color; - this.c.fillRect( - this.posX, - this.posY + 10, - this.width + 10, - this.height - 10 - ); - this.drawFacingDirectionSetUp(direction); - this.drawPantsSetup(); - } - - drawFacingDirectionSetUp(direction) { - if (direction === 'right') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 22, - this.posY + 15, - this.width - this.width / 1.9, - this.height - this.height / 1.2 - ); - } else if (direction === 'left') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 6, - this.posY + 15, - this.width - this.width / 1.9, - this.height - this.height / 1.2 - ); - } - } - - drawPantsSetup() { - this.c.fillStyle = 'black'; - this.c.fillRect(this.posX, this.posY + 32, this.width + 10, 3); - this.c.fillRect(this.posX + 22, this.posY + 35, 5, 13); - } - - drawStanding(color = this.color, direction = this.facingDirection) { - this.c.fillStyle = color; - this.c.fillRect(this.posX, this.posY, this.width, this.height); - this.drawFacingDirection(direction); - this.drawPants(); - } - - drawFacingDirection(facingDirection) { - if (facingDirection === 'right') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 19, - this.posY + 5, - this.width - this.width / 1.7, - this.height - this.height / 1.4 - ); - } else if (facingDirection === 'left') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 5, - this.posY + 5, - this.width - this.width / 1.7, - this.height - this.height / 1.4 - ); - } - } - - drawPants() { - this.c.fillStyle = 'black'; - this.c.fillRect(this.posX, this.posY + 32, this.width, 3); - this.c.fillRect(this.posX + 18, this.posY + 35, 5, 13); - } - - drawKicking(color = this.color, direction = this.facingDirection) { - this.c.fillStyle = color; - this.c.fillRect(this.posX, this.posY, this.height + 5, this.width - 5); - this.drawFacingDirectionKicking(direction); - this.drawPantsKicking(direction); - // this.drawPants(); - } - - drawFacingDirectionKicking(facingDirection) { - if (facingDirection === 'right') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 10, - this.posY + 20, - this.width - this.width / 1.05, - this.height - this.height / 1.4 - ); - } else { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 40, - this.posY + 20, - this.width - this.width / 1.05, - this.height - this.height / 1.4 - ); - } - } - - drawPantsKicking(facingDirection) { - if (facingDirection === 'right') { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 30, - this.posY, - this.width - this.width / 1.07, - this.height - this.height / 3.8 - ); - this.c.fillRect( - this.posX + 30, - this.posY + 16.5, - this.height / 2.1, - this.width - this.width / 1.07 - ); - } else { - this.c.fillStyle = 'black'; - this.c.fillRect( - this.posX + 20, - this.posY, - this.width - this.width / 1.07, - this.height - this.height / 3.8 - ); - this.c.fillRect( - this.posX, - this.posY + 16.5, - this.height / 2.1, - this.width - this.width / 1.07 - ); - } - } - - drawDead(color = this.color, direction = this.facingDirection) { - this.c.fillStyle = color; - this.c.fillRect(this.posX, this.posY, this.width, this.height); - this.drawDeadFace(); - this.drawPantsDead(); - } - - drawDeadFace() { - this.c.strokeStyle = 'black'; - this.c.lineWidth = 4; - this.c.beginPath(); - this.c.moveTo(this.posX+5, this.posY+30); - this.c.lineTo(this.posX+15, this.posY+40); - this.c.stroke(); - - this.c.beginPath(); - this.c.moveTo(this.posX+15, this.posY+30); - this.c.lineTo(this.posX+5, this.posY+40); - this.c.stroke(); - - this.c.beginPath(); - this.c.moveTo(this.posX+25, this.posY+30); - this.c.lineTo(this.posX+35, this.posY+40); - this.c.stroke(); - - this.c.beginPath(); - this.c.moveTo(this.posX+35, this.posY+30); - this.c.lineTo(this.posX+25, this.posY+40); - this.c.stroke(); - } - - drawPantsDead() { - this.c.fillStyle = 'black'; - this.c.fillRect(this.posX, this.posY + 15, this.width, 3); - this.c.fillRect(this.posX + 18, this.posY, 5, 18); - } - - // *** PLAYER MOVEMENT *** - // TODO: use velocityX. fix leftover velocityX. - goLeft(deltaValue) { - this.facingDirection = 'left'; - if (this.posX <= 0) return; - // this.velocityX -= 0.02; - // this.posX += this.velocityX * deltaValue; - this.posX -= 4; - } - - goRight(deltaValue) { - this.facingDirection = 'right'; - if (this.posX >= this.horizontalLimit - this.width - 5) return; - this.posX += 4; - } - - DROPKICK(deltaValue) { - if (this.facingDirection === 'right') { - if (this.posX >= this.horizontalLimit - this.width - 5) return; - this.posX += 0.25 * deltaValue; - } else if (this.facingDirection === 'left') { - if (this.posX <= 0) return; - this.posX -= 0.25 * deltaValue; - } - } - - StopDropKick(deltaValue) { - if (this.facingDirection === 'right') { - if (this.posX >= this.horizontalLimit - this.width - 5) return; - this.posX += 0.05 * deltaValue; - } else if (this.facingDirection === 'left') { - if (this.posX <= 0) return; - this.posX -= 0.05 * deltaValue; - } - } - - goLeftWhileJumping(deltaValue) { - this.facingDirection = 'left'; - if (this.posX <= 0) return; - // this.velocityX -= 0.02; - // this.posX += this.velocityX * deltaValue; - this.posX -= 6.5; - } - - goRightWhileJumping(deltaValue) { - this.facingDirection = 'right'; - if (this.posX >= this.horizontalLimit - 5) return; - // this.velocityX += 0.02; - // this.posX += this.velocityX * deltaValue; - this.posX += 6.5; - } - - fall(deltaValue) { - this.velocityY = 0.4; - this.posY += this.velocityY * deltaValue; - } - - jump(deltaValue) { - this.velocityY = -0.85; - this.posY += this.velocityY * deltaValue; - } - - // *** PLAYER HITBOX *** - _isRightCompBorderCollided(enemy) { - return this._rightCompHb() >= enemy._leftCompHb(); - } - - _isLeftCompBorderCollided(enemy) { - return this._leftCompHb() <= enemy._rightCompHb(); - } - - _isTopCompBorderCollided(enemy) { - return this._topCompHb() <= enemy._botCompHb(); - } - - _isBottomCompBorderCollided(enemy) { - return this._botCompHb() >= enemy._topCompHb(); - } - - isHitTaken(enemy) { - return ( - this._isRightCompBorderCollided(enemy) && - this._isLeftCompBorderCollided(enemy) && - this._isTopCompBorderCollided(enemy) && - this._isBottomCompBorderCollided(enemy) - ); - } - - // *** ATTACK STATE *** - startAttack() { - this.isAttacking = true; - } - - stopAttack() { - this.isAttacking = false; - } - - // *** ATTACK HITBOX *** - drawAttackHitbox() { - this.c.fillStyle = 'transparent'; - if (this.facingDirection === 'right') { - this.c.fillRect( - this.posX + 40, - this.posY - 1, - this.width / 2.3, - this.height - 11 - ); - } else { - this.c.fillRect( - this.posX - 4, - this.posY - 1, - this.width / 2.3, - this.height - 11 - ); - } - } - - _leftAttackHb() { - if (this.facingDirection === 'right') { - return this.posX + 10; - } - return this.posX - 10; - } - - _rightAttackHb() { - if (this.facingDirection === 'right') { - return this.posX + 10 + this.width; - } - return this.posX - 10 + this.width; - } - - _topAttackHb() { - return this.posY - 3; - } - - _botAttackHb() { - return this.posY - 3 + this.height - 5; - } - - _isRightAttackBorderCollided(enemy) { - return this._rightAttackHb() >= enemy._leftCompHb(); - } - - _isLeftAttackBorderCollided(enemy) { - return this._leftAttackHb() <= enemy._rightCompHb(); - } - - _isTopAttackBorderCollided(enemy) { - return this._topAttackHb() <= enemy._botCompHb(); - } - - _isBottomAttackBorderCollided(enemy) { - return this._botAttackHb() >= enemy._topCompHb(); - } - - isHitGiven(enemy) { - return ( - this._isRightAttackBorderCollided(enemy) && - this._isLeftAttackBorderCollided(enemy) && - this._isTopAttackBorderCollided(enemy) && - this._isBottomAttackBorderCollided(enemy) - ); - } -} diff --git a/SinglePlayer - Games/Dropkick_Odyssey/javascript/helperObj.js b/SinglePlayer - Games/Dropkick_Odyssey/javascript/helperObj.js deleted file mode 100644 index 6ecc53c3..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/javascript/helperObj.js +++ /dev/null @@ -1,24 +0,0 @@ -const helper = { - stopInputs() { - // TODO i really should iterate this object instead of writing down each line. - document.removeEventListener('keydown', handleAttackInputKeyDown); - inputStatusObj[17][0] = false; - document.removeEventListener('keydown', handleMoveInputKeyDown); - inputStatusObj[37][0] = false; - // inputStatusObj[38][0] = false; - inputStatusObj[39][0] = false; - }, - resumeInput() { - document.addEventListener('keydown', handleAttackInputKeyDown); - document.addEventListener('keydown', handleMoveInputKeyDown); - }, - stopJumpInputListening() { - document.removeEventListener('keydown', handleJumpInputKeyDown); - }, - resumeJumpInputListening() { - document.addEventListener('keydown', handleJumpInputKeyDown); - }, - generateRandomNumberInArr(min, max) { - return Math.random() * (max - min) + min - } -}; diff --git a/SinglePlayer - Games/Dropkick_Odyssey/javascript/main.js b/SinglePlayer - Games/Dropkick_Odyssey/javascript/main.js deleted file mode 100644 index 21d1bb5b..00000000 --- a/SinglePlayer - Games/Dropkick_Odyssey/javascript/main.js +++ /dev/null @@ -1,461 +0,0 @@ -const element = document.getElementById('canvas'); -const context = document.getElementById('canvas').getContext('2d'); - -element.width = 720; -element.height = 600; - -let requestId; -let lastFrameTimeMs = 0; -const maxFPS = 61; // update this value to control maxFPS -let delta = 0; // elapsed time since last update. -const timestep = 1000 / 60; // update the denominator to control maxFPS - -let victoryToken; -let gameOverToken; - -let startAttackTimestamp; -let attackFrameCounter = 0; -let playerStartPosY; // isJumpingFlag -let playerJumpMaxHeight = 110; - -let randomFrequency = 3200; -const frequencyInMs = randomFrequency; -let startFlag; - -const loopControl = { - start() { - if (!requestId) { - requestId = window.requestAnimationFrame(update); - // return requestId; - } - }, - stop() { - if (requestId) { - window.cancelAnimationFrame(requestId); - requestId = undefined; - } - }, - clear() { - context.clearRect(0, 0, element.width, element.height); - } -}; - -// controller of game rules -const rules = { - enemyArr: [], - allCompArr: [], - floorArr: [], - bossArr: [], - - createPlatform(w, h, width) { - const floor = new Component(context, w, h - 20, width, 20, '#5142f5'); - this.floorArr.push(floor); - return floor; - }, - - createBoss(w, h, width, height, color, isFinalBoss) { - const aBoss = new Enemy(context, w, h, width, height, color, isFinalBoss); - this.allCompArr.push(aBoss); - this.bossArr.push(aBoss); - return aBoss; - }, - // create instances of components - createEnemy(runtime, frequencyInMs, bossPositionX, bossPositionY) { - if ( - Math.floor(parseInt(runtime, 10)) % frequencyInMs > - frequencyInMs - 17 - ) { - const enemy = new Enemy( - context, - bossPositionX, - bossPositionY, - 30, - 30, - 'yellow' - ); - this.allCompArr.push(enemy); - this.enemyArr.push(enemy); - return enemy; - } - }, - - createPlayer() { - const player = new Player(context, 120, 430, 40, 48, 'red', element.width); - this.allCompArr.push(player); - return player; - }, - - gravity(deltaValue) { - this.allCompArr.forEach(e => { - if (e.isHitTaken(this.floorArr[0])) { - if (e.posY === this.floorArr[0].posY - e.height) { - e.velocityY = 0; - } else { - e.posY = this.floorArr[0].posY - e.height; - } - } else if (e.isHitTaken(this.floorArr[1])) { - if (e.posY === this.floorArr[1].posY - e.height) { - e.velocityY = 0; - } else { - e.posY = this.floorArr[1].posY - e.height; - } - } else if (e.isHitTaken(this.floorArr[2])) { - if (e.posY === this.floorArr[2].posY - e.height) { - e.velocityY = 0; - } else { - e.posY = this.floorArr[2].posY - e.height; - } - } else if (e.isHitTaken(this.floorArr[3])) { - if (e.posY === this.floorArr[3].posY - e.height) { - e.velocityY = 0; - } else { - e.posY = this.floorArr[3].posY - e.height; - } - } else if (e.isHitTaken(this.floorArr[4])) { - if (e.posY === this.floorArr[4].posY - e.height) { - e.velocityY = 0; - } else { - e.posY = this.floorArr[4].posY - e.height; - } - } else { - e.fall(deltaValue); - } - }); - }, - - moveAndDrawEnemies() { - this.enemyArr.forEach(e => { - e.draw(); - e.move(timestep); - }); - }, - - isGameover() { - const isPlayerHitByEnemy = this.enemyArr.some(e => { - return player.isHitTaken(e); - }); - const isPlayerHitByBoss = this.bossArr.some(e => { - return player.isHitTaken(e); - }); - const isPlayerHitByFinalBoss = player.isHitTaken(boss2); - return isPlayerHitByEnemy || isPlayerHitByBoss || isPlayerHitByFinalBoss; - }, - - isHitGivenOnEnemy() { - this.enemyArr.forEach((e, i) => { - if (player.isHitGiven(e)) { - this.enemyArr.splice(i, 1); - } - }); - this.bossArr.forEach((e, i) => { - if (player.isHitGiven(e)) { - // this.bossArr.splice(i, 1); - e.posX = 10000; // splice just didn't work - } - }); - }, - - isVictory() { - return player.isHitGiven(boss2); - } -}; - -const floor0 = rules.createPlatform(0, element.height, element.width); - -const floor1 = rules.createPlatform( - element.width / 1.5 - 1, - element.height - 80, - element.width -); - -const floor2 = rules.createPlatform(0, element.height - 190, element.width / 2); - -const floor3 = rules.createPlatform( - element.width / 1.8, - element.height - 320, - element.width / 3 -); - -const floor4 = rules.createPlatform( - 0, - element.height - 450, - element.width / 2.2 -); - -const boss0 = rules.createBoss( - element.width - 100, - element.height - 120, - 60, - 60, - '#f58742', - false -); - -const boss1 = rules.createBoss( - 80, - element.height - 350, - 60, - 60, - '#f58742', - false -); - -const boss2 = rules.createBoss( - 60, - element.height - 500, - 80, - 80, - 'crimson', - true -); - -const player = rules.createPlayer(); -// *** INPUTS *** - -const inputStatusObj = { - 17: [false, 0], - 37: [false, 0], - 38: [false, 0], - 39: [false, 0] -}; - -const updateJumpInput = deltaValue => { - if (inputStatusObj[38][0]) { - helper.stopJumpInputListening(); - if (!playerStartPosY) { - playerStartPosY = player.posY; - } - player.jump(deltaValue); - } else { - playerStartPosY = undefined; - } -}; - -const updatePlayerMovement = deltaValue => { - if (inputStatusObj[37][0] && inputStatusObj[39][0]) { - if (inputStatusObj[37][1] > inputStatusObj[39][1]) { - if (!inputStatusObj[38][0]) { - player.goLeft(deltaValue); - } else { - player.goLeftWhileJumping(deltaValue); - } - } else { - if (!inputStatusObj[38][0]) { - player.goRight(deltaValue); - } else { - player.goRightWhileJumping(deltaValue); - } - } - } - if (inputStatusObj[37][0]) { - if (!inputStatusObj[38][0]) { - player.goLeft(deltaValue); - } else { - player.goLeftWhileJumping(deltaValue); - } - } - if (inputStatusObj[39][0]) { - if (!inputStatusObj[38][0]) { - player.goRight(deltaValue); - } else { - player.goRightWhileJumping(deltaValue); - } - } -}; -const handleMoveInputKeyDown = input => { - switch (input.keyCode) { - case 37: - inputStatusObj[input.keyCode] = [true, new Date().getTime()]; - break; - case 39: - inputStatusObj[input.keyCode] = [true, new Date().getTime()]; - break; - default: - break; - } -}; -document.addEventListener('keydown', handleMoveInputKeyDown); - -const handleMoveInputKeyUp = input => { - switch (input.keyCode) { - case 37: - inputStatusObj[input.keyCode] = [false, 0]; - break; - case 39: - inputStatusObj[input.keyCode] = [false, 0]; - break; - default: - break; - } -}; - -document.addEventListener('keyup', handleMoveInputKeyUp); - -const handleAttackInputKeyDown = input => { - if (input.keyCode === 17) { - inputStatusObj[input.keyCode] = true; - player.startAttack(); - } -}; -document.addEventListener('keydown', handleAttackInputKeyDown); - -const handleAttackInputKeyUp = input => { - if (input.keyCode === 17) { - inputStatusObj[input.keyCode] = false; - // player.startAttack(); - } -}; -document.addEventListener('keyup', handleAttackInputKeyUp); - -const handleJumpInputKeyDown = input => { - if (input.keyCode === 38) { - inputStatusObj[input.keyCode] = [true, new Date().getTime()]; - } -}; -document.addEventListener('keydown', handleJumpInputKeyDown); - -const handleJumpInputKeyUp = input => { - if (input.keyCode === 38) { - inputStatusObj[input.keyCode] = [false, new Date().getTime()]; - } -}; -document.addEventListener('keyup', handleJumpInputKeyUp); - -function update(runtime) { - requestId = undefined; - loopControl.clear(); - if (runtime < lastFrameTimeMs + 1000 / maxFPS) { - loopControl.start(); - return; - } - // track the accumulated time that hasn't been rendered yet - delta += runtime - lastFrameTimeMs; - lastFrameTimeMs = runtime; - // render the total elapsed time in fixed-size chunks - let numUpdateSteps = 0; - while (delta >= timestep) { - // do everything here: - - floor0.draw(); - floor1.draw(); - floor2.draw(); - floor3.draw(); - floor4.draw(); - if (player.velocityY === 0) { - helper.resumeJumpInputListening(); - } - if (player.posY < playerStartPosY - playerJumpMaxHeight) { - inputStatusObj[38][0] = false; - } - updateJumpInput(timestep); - updatePlayerMovement(timestep); - - rules.createEnemy(runtime, frequencyInMs, boss0.posX, boss0.posY); - rules.createEnemy(runtime, frequencyInMs, boss1.posX, boss1.posY); - rules.createEnemy(runtime, frequencyInMs, boss2.posX, boss2.posY); - - rules.gravity(timestep); - rules.moveAndDrawEnemies(); - boss0.draw(); - boss1.draw(); - boss2.draw(); - if (startFlag) { - boss2.bigbossMove(); - } - if (!startAttackTimestamp) { - player.drawStanding(); - } - - if (player.isAttacking) { - helper.stopInputs(); - helper.stopJumpInputListening(); - if (!startAttackTimestamp) { - startAttackTimestamp = runtime; - } - const attackDuration = 1000; - const endAttackTimeStamp = startAttackTimestamp + attackDuration; - - if (runtime < endAttackTimeStamp) { - attackFrameCounter += 1; - // player.drawAttackHitbox(); - // TODO: attack frames here - if (attackFrameCounter < 15) { - player.drawSetup(); - } else if (attackFrameCounter >= 15 && attackFrameCounter <= 42) { - player.drawAttackHitbox(); - player.drawKicking(); - player.DROPKICK(timestep); - if (rules.isVictory()) { - victoryToken = true; - } - rules.isHitGivenOnEnemy(); - } else if (attackFrameCounter > 42) { - player.drawDead(); - player.StopDropKick(timestep); - } - } else { - attackFrameCounter = 0; - startAttackTimestamp = undefined; - player.stopAttack(); - helper.resumeInput(); - } - } - if (rules.isGameover()) { - gameOverToken = true; - - } - - if (victoryToken) { - loopControl.stop(); - setTimeout(() => { - let logger = document.getElementById('logger'); - logger.innerText = `YOU DID IT! \n - (ಥ﹏ಥ)` - logger.style.backgroundColor = 'green' - logger.className = 'logger'; - document.getElementById('overlay').style.display = 'flex' - document.addEventListener('keydown', reloadPage); - }, 2000) - } else if (gameOverToken) { - player.drawDead(); - loopControl.stop(); - setTimeout(() => { - logger.innerText = `GAME OVER \n \n (ง'̀-'́)ง TRY AGAIN!` - logger.style.backgroundColor = 'red' - logger.className = 'logger'; - document.getElementById('overlay').style.display = 'flex' - document.addEventListener('keydown', reloadPage); - }, 800) - } else { - loopControl.start(); - } - - delta -= timestep; - // sanity check - if (++numUpdateSteps >= 240) { - delta = 0; // fix things - reloadPage(); - // break; // bail out; - } - } - // end -} - -const handleStartGame = input => { - if (input.keyCode === 32) { - document.getElementById('overlay').style.display = 'none'; - document.removeEventListener('keydown', handleStartGame); - randomFrequency = helper.generateRandomNumberInArr(2800, 3800); - loopControl.start(); - } -}; - -function reloadPage (input) { - if (input.keyCode === 32) { - window.location.reload(false); - document.getElementById('overlay').style.display = 'none'; - } -} - -setTimeout(() => {startFlag = true}, 20000); -document.addEventListener('keydown', handleStartGame); diff --git a/additionalpage/game.html b/additionalpage/game.html index 597021ca..b155e5aa 100644 --- a/additionalpage/game.html +++ b/additionalpage/game.html @@ -1552,58 +1552,6 @@

Curve

- - - - -
-
- -
- 41 - -
-
-
- -
-
-

Dropkick Odyssey

-

Dropkick Odyssey draws inspiration from classic platformers like Mario, offering a captivating gameplay experience.

-
-
- - - - - -
-
-
-
-
-

Release Date:  

-

28.05.2023

-
-
-

Updated:  

-

Action | Desktop

-
-
-
- Play Now -
-
-
-
- -