Enjoy Free Ninja Plumber - An HTML5 Platformer Arcade Game with Source Code

27 May 2023 Balmiki Mandal 0 Html

Ninja Plumber – HTML5 Game

Ninja Plumber – HTML5 Game is a simple, 2D platformer game in which the player controls a ninja plumber who must navigate a series of levels, avoiding obstacles and defeating enemies. The game is made with the HTML5 canvas element and JavaScript, and it can be played in any web browser.

The game is played by using the arrow keys to move the ninja plumber, and the spacebar to jump. The player must avoid obstacles such as spikes and falling rocks, and they must also defeat enemies such as ninjas and bats. The player can collect power-ups to help them progress through the levels, such as a double jump and a sword.

The game has a total of 15 levels, and each level is more challenging than the last. The player must use their skills and abilities to reach the end of each level and defeat the final boss.

Ninja Plumber – HTML5 Game is a fun and challenging game that is perfect for players of all ages. It is a great way to test your skills and abilities, and it is also a lot of fun to play.

Here are some additional details about the game:

  • Gameplay: Ninja Plumber – HTML5 Game is a 2D platformer game in which the player controls a ninja plumber who must navigate a series of levels, avoiding obstacles and defeating enemies.
  • Controls: The game is played using the arrow keys to move the ninja plumber, and the spacebar to jump.
  • Levels: The game has a total of 15 levels, each more challenging than the last.
  • Power-ups: The player can collect power-ups to help them progress through the levels, such as a double jump and a sword.
  • Boss: The player must defeat the final boss to complete the game.

Ninja Plumber – HTML5 Game is a fun and challenging game that is perfect for players of all ages. It is a great way to test your skills and abilities, and it is also a lot of fun to play.

 

source code for the Ninja Plumber – HTML5 Game:




  
  
  
  


  
  
  

 

  constructor(canvas) {
    this.canvas = canvas;
    this.ctx = canvas.getContext("2d");
    this.x = 250;
    this.y = 250;
    this.vx = 0;
    this.vy = 0;
  }

  handleKeydown(event) {
    switch(event.keyCode) {
      case 38: // Up arrow
        this.vy -= 10;
        break;
      case 40: // Down arrow
        this.vy += 10;
        break;
      case 37: // Left arrow
        this.vx -= 10;
        break;
      case 39: // Right arrow
        this.vx += 10;
        break;
    }
  }

  update() {
    // Move the Ninja Plumber.
    this.x += this.vx;
    this.y += this.vy;

    // Check for collisions with the edges of the canvas.
    if (this.x  canvas.width) {
      this.x = canvas.width;
    }

    if (this.y  canvas.height) {
      this.y = canvas.height;
    }
  }

  draw() {
    // Draw the Ninja Plumber.
    this.ctx.fillStyle = "red";
    this.ctx.fillRect(this.x, this.y, 50, 50);
  }
}

This is just a basic example of how to create a Ninja Plumber – HTML5 Game. You can add more features and levels to make the game more challenging and fun.



Sources path:

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.