A simple and interactive 2D billiard game built using JavaScript and HTML5 canvas, designed to showcase fundamental concepts in vector math, collision handling, and game mechanics.
This project demonstrates the mechanics of a billiard game, featuring realistic physics-based ball movement, collision detection, and user interaction with a virtual pool stick. It's intended as a portfolio sample to illustrate skills in game development and JavaScript programming.
Before running the project, ensure you have the following:
- A modern web browser with JavaScript enabled.
- A local server to handle the
file://
limitations when loading assets, or run directly in a browser extension allowing local file access.
-
Clone the repository:
git clone https://github.com/sajjad-sisakhtpour/billiard.git
-
Navigate to the project folder:
cd billiard
-
Open
index.html
in a browser, or serve the project using a local server (e.g., Python'shttp.server
):python -m http.server
- Use the mouse to aim and adjust the stick's rotation.
- Hold the left mouse button to charge power.
- Release the button to shoot.
Here’s how the game looks in action:
- Physics-Based Ball Movement: Implements realistic velocity and friction.
- Vector Operations: Includes custom vector math utilities.
- User Interaction: Dynamic stick rotation and power control.
- Asset Loading: Efficient sprite management through asynchronous loading.
- Canvas Rendering: Smooth rendering of game objects using transformations.
Contributions are welcome! Follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature"
- Push to the branch:
git push origin feature-name
- Create a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
For inquiries or feedback, reach out:
- Email: [email protected]
- GitHub: github.com/sajjad-sisakhtpour
- LinkedIn: ir.linkedin.com/in/sajad-sisakht-pour
A live version of the game can be hosted and viewed on platforms like GitHub Pages. here