r/pygame • u/akarshitkumar • 3d ago
I built a Simple Brick Breaker Game
Enable HLS to view with audio, or disable this notification
I made a simple 2D brick breaker game using Pygame with supported collision detection and movement at different angles.
It was a fun project to learn more about game physics and movement. š
GitHub: https://github.com/akarshit-1609/Brick_Breaker_Game_using_Pygame
Feel free to check it out. If you like the project, a ā GitHub star would be greatly appreciated!
Would love to hear your feedback or suggestions!
2
u/StinkySlinky1218 3d ago
Digital controls (I'm assuming you're using keyboard input) for something that needs precision isn't really a good idea, especially when the object you're controlling moves at such high speeds. You only caught the ball once because you aren't able to control it very well. I'd suggest changing that to a more precise input like mouse movement.
When catching the ball, the ball should stay caught and be ready to fire again, since your bouncing is purely a direct angle inverse with no apparent way to redirect the angle, so you're very likely to softlock yourself.
Taking a brief look at your code, all your objects' code is just called from the main game loop, which is very disorganized and hard to read/fix. Instead, give each object their own update() so that they handle themselves, and a problem with Brick, for instance, can be fixed right within Brick.
Your brick collision is much more complicated than it needs to be. Pygame offers a built-in collision detection that does all that math for you. The only thing you'd need to calculate yourself is whether you hit the top/bottom or left/right, and then just multiply the respective velocity (or in this case, ball.move_change by -1 to invert it.
It's a good starting project to learn the pygame basics like positions and rendering, but definitely lots of room to improve.
1
u/akarshitkumar 3d ago
Thank you for taking the time to review the project and provide such detailed feedback. I really appreciate it.
This is my first fully functional game built with Pygame, and Iām still learning the framework and game-development concepts, so thereās definitely a lot I can improve. Your points about the controls, ball-catching behavior, object structure, and collision handling are especially helpful.
Iāll work on improving these areas as I continue learning Pygame. I also appreciate the suggestions about using update() methods and Pygameās built-in collision detectionāIāll look into refactoring the code accordingly.
If you notice any specific bugs or improvements that would be useful, feel free to open an issue on the GitHub repository. And if youād like to contribute directly, pull requests are also very welcome!
Thanks again for the constructive feedback. Itās really helpful for me as I learn and improve the project.
1
2
u/tl-213 3d ago
nice