# Breakout paddle ball bouncing woes

This topic is 3670 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi guys. Im making a brekout game, but i am having problems making the ball bounce farther away when it touches the ends of one of the paddles. This is my code:
if(paddleCollision(&m_paddlePos))
{
//now reflect ball

{
//Hit the right end of the paddle
m_ballVel.y += 5.0f;
if(m_ballVel.x > 0.0f)
m_ballVel.x += 2.5f;
else
m_ballVel.x -= 2.5f;
D3DXVec3Normalize(&m_ballVel, &m_ballVel);
m_ballVel.x *= m_ballSpeed;
m_ballVel.y *= m_ballSpeed;
}
{
//Hit the right end of the paddle
m_ballVel.y += 5.0f;
if(m_ballVel.x > 0.0f)
m_ballVel.x += 2.5f;
else
m_ballVel.x -= 2.5f;
D3DXVec3Normalize(&m_ballVel, &m_ballVel);
m_ballVel.x *= m_ballSpeed;
m_ballVel.y *= m_ballSpeed;
}
}


Basically, what I am trying to do is prevention for when the ball goes up and down, without a real change in velocity. So what I want to do is to make the ball bounce at a greater angle when it collides with the paddle. Anyone got any ideas how i could fix my code?

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
12

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633767
• Total Posts
3013738
×