WHAT I LEARNED IN THE PROCESS OF MAKING BREAKOUT
Object Oriented vs. Procedural Programming
Coming off of Pong, I tried to everything with classes. In my next iteration, I found a balance between Object-Oriented and Procedural Programming, creating functions to handle common tasks, and knowing what to make a member function and what to not. I'm now using both classes and functions depending on my needs, which makes my code cleaner, and more expansive. When I wanted to add a new row of bricks, all I did was type in 1 lines of code to create the bricks, but since I had a function that automatically updated a row I passed in as a parameter and a function that draws the row, it was ~4 more lines to add the row into my game loop.
Vectors and Arrays: Their Limitations and Uses
I ran into a predicament about halfway through where I couldn't use a non-default constructor on my array. I Googled Arrays and was pointed to vectors. In the documentation it talked about how to initialize an array of vectors using a non-default constructor. Problem Solved! I also learned array are automatically passed by reference, unlike vectors, and how I can use arrays vs. how I can use vectors.
Structure and Organization
Commenting. I fully commented my code, and made it a habit through this project. It should help your guys understanding, and mine if I ever want to modify my code. I also used white-space / indentation to structure and organize my code. Having a block of code for creating images, and another for loading those images from files, makes finding where I'm doing things and how I'm doing them easy.
Only Application: Here (Extract .rar and double click Breakout.exe to run game.)
Only Source Files: Here (Extract .rar)
Edited by superman3275, 21 October 2012 - 07:09 PM.