Skip to content

vermaharsha/Pong-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Pong Game - JavaScript Canvas Edition

A classic Pong game recreation built using HTML5 Canvas and Vanilla JavaScript. The player controls the left paddle with mouse movement, while the right paddle is controlled by a basic AI. This project demonstrates game physics, paddle-ball collision logic, and responsive animation via requestAnimationFrame.


๐Ÿงฉ 1. Project Overview

This is a browser-based version of the iconic Pong game. It utilizes core JavaScript functionalities to create an interactive, real-time paddle-and-ball game with a simple AI opponent. This game runs entirely in the browser with no external game engine or library dependencies.


โœจ 2. Features

  • Mouse-controlled Paddle: Move the left paddle using your mouse.
  • AI Paddle: Right paddle follows the ball with basic logic.
  • Ball Bounce Physics: Reflects off paddles and walls with angle-based direction.
  • Scoring Logic: Ball resets after missing either paddle (point scored).
  • Collision Spin Effect: Collision point adds variation to ballโ€™s bounce angle.
  • Center Net: Aesthetic dotted net in the center of the game.
  • Smooth Gameplay: Uses requestAnimationFrame() for efficient rendering.

๐Ÿ› ๏ธ 3. Technologies Used

Technology Purpose
HTML5 Structure of canvas and page
CSS3 Styling canvas and layout
JavaScript ES6 Game logic and animations
HTML Canvas API Drawing objects and animation

โš™๏ธ 4. Setup Instructions

Follow these steps to run the game locally:

  1. Clone the repository or copy the files:

    git clone https://github.com/yourusername/pong-game.git
    cd pong-game
  2. File Structure:

    pong-game/
    โ”œโ”€โ”€ index.html
    โ”œโ”€โ”€ style.css
    โ””โ”€โ”€ script.js
    
  3. Open index.html in your browser: Just double-click the file.

  4. Start Playing: Move your mouse up and down inside the canvas to control the left paddle.



๐Ÿ“ธ Screenshots

Pong Game


๐Ÿ™Œ Acknowledgments

  • Inspired by the classic Pong arcade game (1972).
  • Game logic and collision approach based on physics and math functions (Math.sin, Math.PI).
  • HTML5 Canvas API for real-time rendering.

Author ๐Ÿ’ป

Made with love by Harsha Verma

Releases

No releases published

Packages

No packages published