I have very simple question. how do I black out a brick when the ball hits it, I want the ball to bounce off the brick and then erase the brick and the next time I want the ball to pass through where the brick was at. I am doing this game in win32 because I want to get good at direct x , this a launching platform.
win32 breakout
There are plenty of Breakout tutorials on the web that will walk you through step-by-step. Why are you not using them?
Also, you have a thread from 3 or so months ago that answered this question over and over and over......
🙂🙂🙂🙂🙂<←The tone posse, ready for action.
You know how you have code which draws the brick and checks if the ball hits it? Stop doing that.
13 hours ago, Nypyren said:You know how you have code which draws the brick and checks if the ball hits it? Stop doing that.
can you explain what to do more specifically.
foreach (brick in bricks) draw brick;
if (brick is hit) bounce ball and remove brick from bricks;
or
foreach (place where a brick could be) if (a brick exists there) draw it;
if (ball reaches place and brick is there) bounce ball and remove brick from place;
here is my code for drawing bricks,should I make changes to it? I was thinking about using a list for my bricks.
for(int i=0; i<=725;i+=225)
{
DrawBitmap_one("red.bmp", i, 200);
}
for(int i=75; i<=725;i+=225)
{
DrawBitmap_two("green.bmp", i, 200);
}
for(int i=150; i<=725;i+=225)
{
DrawBitmap_three("blue.bmp", i, 200);
}
for(int i=0; i<=725;i+=225)
{
DrawBitmap_two("green.bmp", i, 165);
}
for(int i=75; i<=725;i+=225)
{
DrawBitmap_three("blue.bmp", i, 165);
}
for(int i=150; i<=725;i+=225)
{
DrawBitmap_one("red.bmp", i, 165);
}
for(int i=0; i<=725;i+=225)
{
DrawBitmap_three("blue.bmp", i, 130);
}
for(int i=75; i<=725;i+=225)
{
DrawBitmap_one("red.bmp", i, 130);
}
for(int i=150; i<=725;i+=225)
{
DrawBitmap_two("green.bmp", i, 130);
}
Since bricks may disappear during the game, you need a value for each brick that says whether it (still) exists. If a value for a brick says "brick doesn't exist", you skip drawing that brick.
Alongside a list of bricks, you could have a list of such values.