hey dertroll can I get some more input from you.
win32 breakout
Why don't you want to open Youtube or the Internet and search:
- c++ breakout tutorial
or
- c++ arkanoid tutorial
I like this tutorial that was created by Mozilla team "2D breakout game using pure JavaScript": https://developer.mozilla.org/en-US/docs/Games/Tutorials/2D_Breakout_game_pure_JavaScript
It uses Canvas API and JavaScript but you can translate it to C++. For example, I want to translate it to C# and OpenGL 3. I will use textures instead of colors. I will publish my result here to show you how it is simple to translate it to another language and drawing method. If you like C++ you can translate it to SFML or SDL2. They are cross-platform. I like cross-platform tools because a lot of people use Mac or Linux. But if you use WinAPI to study how Windows works - it is good.
Hi Phil.
#DerTroll had a number of valid questions that you ignored. That is not how an idea exchange works. I've had better conversations with my cat, who by the way has an opinion here as well.
edit: @8Observer8 thank you for the pure javascript breakout thing. I did a speed run on that yesterday and very much enjoyed myself for the hour it took to breeze through it. Very cool. Looking at that, it's obvious...Every (gameplay) problem phil has spoke to in the last six months is answered simply in very (umm, very) short code sequences and at least a paragraph of description for every line. Ignoring environment, the concepts are easily interpreted to other languages or even visual programming. Skipping that is a missed opportunity in this case.
Dev careful. Pixel on board.
After not programming in C++ for several years, I found that going through this:
http://www.cplusplus.com/doc/tutorial/
Was very helpful. It doesn't take very long to get through, and once you're done with that you'll be able to program in C++ a lot faster.
QuoteI 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.
The short answer is to stop drawing it. If that doesn't work, then you'e probably not refreshing every frame, and that means you missed a very fundamental design pattern in video games made for the last 40 years.
Each frame should start blank, and get drawn to. You should have two canvases at any given time, one that is being displayed, and one that is being drawn to. Once drawing is done, that canvas should be flipped to be displayed and the next frame should start drawing.
A simple game loop would look something like this:
bool gameRunning = true;
double thisTime;
double deltaTime;
// Not a real function, this is sudo code.
double lastTime = GetSystemTimeInMiliseconds();
while (gameRunning) {
// We want to know how much time passed between now and the last updates.
thisTime = GetSystemTimeInMiliseconds();
deltaTime = thisTime - lastTime;
lastTime = thisTime;
// Check inputs
ReceiveInputs();
// Update all the active actors, check collisions.
UpdateActors(deltaTime);
// Draw all the active actors to a canvas and then flip the canvas to the display.
DrawFrame();
}
Once you have that working, then to "black out" a brick is as simple as not drawing it anymore.
Game loops get more complicated, but I think this is the best place to start.