well I have decided to finish my breakout game using opengl and c++. I am still stuck on how to get the ball to bounce off the brick and get it to disappear. Then when it is removed I want the ball to pass through the space where the brick was. Please don't give me a lot of code. Also I am using magic numbers for now. Here is just a little bit of code.
if(x>=3.0f && x<=5.0f && y>=3.5f && y<=4.0f) { ystep = -ystep; g_bBlock[4].m_bActive_three=false; }well this code checks for a brick and then switches the ball's velocity and then turns off the brick. but it still bounces off where the brick was. I know I have asked this question before but I would like a fresh perspective. I am doing my best to finish this project.
simply check that the brick is still valid when your comparing to hit it, like so:
if(x>=3.0f && x<=5.0f && y>=3.5f && y<=4.0f && g_bBlock[4].m_bActive_three==true) {
ystep = -ystep;
g_bBlock[4].m_bActive_three=false;
}
your naming convention is a bit odd(_three?)
edit: also, just to toss this out their for thought: what happens when your ball impacts the block along the side's rather than top or bottom?