Skip to content

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 โ€“ zhechevtony@gmail.com

๐Ÿ”ฅ 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