This is a simple implementation of the classic Pong game using HTML canvas and JavaScript. Inspired by Marcin's Monskała Book "JavaScript from scratch".
The game is played by two players, each controlling a paddle on opposite sides of the canvas. The objective is to hit the ball with the paddle and prevent it from reaching the player's side. The ball will bounce off the top and bottom walls as well as the paddles. When the ball passes the paddles and reaches a player's side, the opponent scores a point. The game continues until one player reaches a certain number of points, typically 10.
-
Player 1 (left paddle):
- Move Up: W key
- Move Down: S key
-
Player 2 (right paddle):
- Move Up: Up Arrow key
- Move Down: Down Arrow key
-
Pause/Resume: B key
To try the game, open the index.html
file in a web browser. Use the controls mentioned above to move the paddles and hit the ball. Press the B key to pause or resume the game.
This project was inspired by the classic Pong game and was created as a learning exercise. It utilizes HTML canvas and JavaScript to implement the game mechanics. The code was developed based on Marcin's Monskała Book "JavaScript from scratch".
Oskar Kalbarczyk https://linktr.ee/codewithoskar
Feel free to reach out if you have any questions or feedback.