Skip to content

This Python project is a physics simulation where two balls bounce inside a rotating hexagon.

License

Notifications You must be signed in to change notification settings

TonyZhechev/Bouncing-Balls-in-a-Rotating-Hexagon-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🎮 Bouncing Balls in a Rotating Hexagon 📌 Overview This Python project simulates two bouncing balls inside a rotating hexagon using Pygame. The balls interact with the hexagon's moving walls, affected by gravity, friction, and realistic collisions.

The project demonstrates: ✅ Physics Simulation – Realistic gravity, friction, and bouncing behavior. ✅ Dynamic Environment – The hexagon rotates, affecting ball movement. ✅ Collision Mechanics – Walls and balls respond naturally to interactions. ✅ Smooth Animations – Optimized rendering with Pygame.

🔹 Ideal for game physics enthusiasts, Python developers, and those learning Pygame & simulation mechanics.

🚀 Features 🎯 Realistic Ball Movement – Gravity & friction slow balls down over time. 🔄 Rotating Hexagon – The walls constantly move, making physics more challenging. 🏀 Wall Collisions – Balls bounce off moving walls with proper angle reflections. ⚙️ Optimized Performance – Smooth animations with vector math. 🎨 Object-Oriented Code – Easy to modify and extend. 📸 Demo Preview 🖼️ Screenshot- 🎮 Bouncing Balls in a Rotating Hexagon

🛠️ Installation 1️⃣ Clone the Repository First, download the project files:

bash Copy Edit git clone https://github.com/YOUR-USERNAME/BouncingBalls-Hex.git cd BouncingBalls-Hex 2️⃣ Install Dependencies Ensure you have Python 3.x installed. Then install Pygame:

bash Copy Edit pip install pygame 3️⃣ Run the Project To launch the simulation, execute:

bash Copy Edit python main.py 🎮 How to Play & Experiment The hexagon rotates continuously, affecting ball collisions. Balls bounce dynamically based on the hexagon's movement. Modify gravity, friction, and hexagon speed to experiment with different behaviors! 🔧 Try customizing:

Change ball sizes & colors. Adjust hexagon rotation speed. Modify gravity effects for different results. 📜 License This project is licensed under the MIT License, meaning you’re free to use, modify, and distribute it. See LICENSE for details.

🌟 Contributing Want to enhance this project? Feel free to fork the repo and submit pull requests.

bash Copy Edit git checkout -b new-feature git commit -m "Added a cool feature" git push origin new-feature 📩 Contact 💬 Got questions or suggestions? Reach out via:

GitHub Issues – Report bugs & request features. Email – [email protected]

🔥 Future Improvements (Next Steps) 🚀 Planned Features: ✅ Add ball-to-ball collisions. ✅ Implement variable rotation speeds for the hexagon. ✅ Introduce different ball sizes & behaviors. ✅ Add a GUI for changing physics settings. ⭐ Support the Project If you like this project, please star ⭐ the repository on GitHub! It helps others discover it. 😊

About

This Python project is a physics simulation where two balls bounce inside a rotating hexagon.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages