Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Brick Breaker, Need help on moving the panel and the ball
Aubrey12 last edited by
We've received an assignment to create a basic brick breaker game. I am very new to qt and I'm struggling on finding a way how to move the panel over the screen, as well as the bouncing and moving of the ball. The rest I am able to do.
Can anyone help me with this please?
matti- last edited by
Arcanoid clone? You'll want to capture mouse events (or touch events) for moving the paddle and then you need to apply simple collision detection with the ball against the edges, paddle and the blocks. 2D vector math & reflection vector are your friends there.
RavensAngel last edited by
Assuming this is a 2D game, you should look into the "Graphics View Framework":http://qt-project.org/doc/qt-4.8/graphicsview.html
When you use the QGraphicsItem as base class for your viewable items, you get the collision detection algorithm for free. Allthough not the top of the edge, it will satisfy your needs.
You should check the "Colliding Mice example":http://qt-project.org/doc/qt-4.8/examples-graphicsview.html
It will show you how to move items etc, also look at Asteroids.
The logic behind the original arcanoid, was very simple towards ball movement. It will change the velocity of the ball depending on the collision location (left, middle, right).
I think you have enough to look at, so get started.