@JohnMiz wrote:
Hello,
I am trying for a long time to finish a clone of the game brick breaker.
I am having trouble with the speed of my ball, I searched all over the internet and could not get the desirable solution.
All I want is to make the ball move in constant velocity for all over the time without any changes.When the ball is colliding with the paddle:
Vec2 vel = ballBody->getVelocity(); vel.x = (ball_center - paddle_center) * 7.5; vel.y = -vel.y; ballBody->setVelocity(vel);
When the ball is colliding with brick:
Vec2 vel = ballBody->getVelocity(); vel.x = vel.x; vel.y = -vel.y; ballBody->setVelocity(vel);
I tried almot everything.
Thanks for help!
Posts: 3
Participants: 2