dev-AshishRanjan / Hacktoberfest-Frontend

Make your Pull Request for Hacktoberfest 2023 in the Web domain specially Frontend. And give this repo a ⭐
https://frontend-database.netlify.app
MIT License
14 stars 37 forks source link

i Added Javascript game which was created using html css js #52

Closed darshitdudhaiya closed 8 months ago

darshitdudhaiya commented 8 months ago

Describe your change:

Checklist:

ATTACH SCREEN-SHOTS

Before After

image | image |

netlify[bot] commented 8 months ago

Deploy Preview for frontend-database ready!

Name Link
Latest commit 7bf0350bcc0c4f78141eb984551d7cab614cc804
Latest deploy log https://app.netlify.com/sites/frontend-database/deploys/652a2d28018f9e00081c87fa
Deploy Preview [https://deploy-preview-52--frontend-database.netlify.app/projects/shooting game/game](https://deploy-preview-52--frontend-database.netlify.app/projects/shooting game/game)
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pr-explainer-bot[bot] commented 8 months ago

Pull Request Review Markdown

Hey there! 👋 I've summarized the previous results for you to write a pull request review markdown document. Let's get started!

Changes

  1. Added a new project 'Shooting Game' to the ProjectList.json file.
  2. Added the necessary details for the 'Shooting Game' project.
  3. Added a new event listener for the 'load' event on the window object.
  4. Created a new class called InputHandler to handle keyboard input.
  5. Added logic to handle different key presses and perform corresponding actions.
  6. Created a new class called Projectile to represent projectiles in the game.
  7. Added logic to update and draw projectiles on the canvas.
  8. Created a new class called Particle to represent particles in the game.
  9. Added logic to update and draw particles on the canvas.
  10. Created a new class called Player to represent the player character in the game.
  11. Added logic to update and draw the player character on the canvas.
  12. Added logic to handle shooting projectiles from the player character.
  13. Created a new class called Enemy to represent enemies in the game.
  14. Added logic to update and draw enemies on the canvas.
  15. Added sprite animation logic for the game characters.
  16. Added debug mode to display hitboxes and additional information.
  17. Added different enemy classes with unique properties.
  18. Added layer class for parallax scrolling background.
  19. Added UI class to display score, timer, and game over messages.
  20. Added game over condition based on score and time limit.
  21. Added ammo (ammunition) system with a timer and interval.
  22. Added speed modifier for background layers.
  23. Added power-up functionality for the player character.

Suggestions

  1. In game.js, lines 47-49, instead of using multiple if-else statements, consider using a switch statement for better code readability.
  2. In game.js, lines 68-70, instead of using multiple if-else statements, consider using a switch statement for better code readability.
  3. Consider using a constant for the canvas width and height instead of hardcoding the values.
  4. Use more descriptive variable names in the InputHandler class.
  5. Refactor the logic for handling key presses and releases in the InputHandler class to make it more readable.
  6. Consider using a separate class for handling sound effects instead of directly manipulating the 'hitSound' element.
  7. Use more descriptive variable names in the Projectile class.
  8. Consider using a separate class for handling sprite animations instead of directly manipulating the player character's frameX and frameY properties.
  9. In the draw method of the Player class, consider using a separate method for drawing the player's lives instead of including it in the same method.
  10. In the draw method of the UI class, consider using a more descriptive variable name instead of formattedTime.
  11. In the update method of the Game class, consider using a more descriptive variable name instead of deltaTime.

Bugs

  1. The 'Shooting Game' project might have potential bugs in the game.js file.
  2. The 'Shooting Game' project might have potential bugs in the game.html file.
  3. The draw method of the Player class may have a potential bug. The context.drawImage call at line 34 has the height and width parameters swapped.
  4. The draw method of the UI class may have a potential bug. The context.fillText call at line 68 has the x and y parameters swapped.

Improvements

  1. In game.js, lines 47-49, the multiple if-else statements can be refactored for better readability using a switch statement. Here's the refactored code snippet:
    switch (randomize) {
    case < 0.3:
    this.enemies.push(new Angler1(this));
    break;
    case < 0.6:
    this.enemies.push(new Angler2(this));
    break;
    case < 0.8:
    this.enemies.push(new HiveWhale(this));
    break;
    default:
    this.enemies.push(new LuckyFish(this));
    break;
    }
  2. In the draw method of the Player class, consider using a separate method for drawing the player's lives instead of including it in the same method.
  3. In the draw method of the UI class, consider using a more descriptive variable name instead of formattedTime.
  4. In the update method of the Game class, consider using a more descriptive variable name instead of deltaTime.

Rating

I cannot rate the code as I am a bot and do not have the capability to evaluate code.

That's it! You can now use this information to write your pull request review markdown document. Good luck! 🚀

dev-AshishRanjan commented 8 months ago

You can also checkout our Idea-Arca, the project idea bank for any languages, for open-source contributions. The PR from this repo is being accepted in hacktoberfest2023

Happy Contributing season! Keep up the good work!