Thanks Josh, you the man. Seriously I appreciate a Engineering Lead taking time out of their day to look am some scrub/noob code.
I will really think about how to improve my code. thanks for the head-ups.
- To answer your question about ball/wall collision. I am not really sure how i would do that, but your question has certainly given me something to think about. I don't know if I know a more efficient way to handle that collision.
- To answer your other question about my Sprite Manager. I suppose I could could have the brick laying in my StartGame() be a method specific to brick rather than it being in the StartGame(). Or maybe i could have my StartGame stuff in the loadcontent
Simply put and to cover Josh's pointers "code refactoring". Take this scenario in a breakout as your chosen game:-
- you decide to add falling power ups that are spawned when bricks break.
Think about what you need now to catch those falling power ups with your paddle and or the ball maybe? Where would your code need editing?
The same applies to sprite manager combined with game logic in this case. Never be afraid to break your code down and make it useable for later projects. Remember your next game might need collision detection but there are no balls and bricks!
You need to check this principle out http://en.wikipedia.org/wiki/Single_responsibility_principle
Good work, keep it up!