Here's the link to the .zip fie containing my project:
http://www.mediafire.com/?r7l6hfxf8dh8c37
Edited by superman3275, 13 October 2012 - 08:11 PM.
Posted 13 October 2012 - 07:25 PM
Edited by superman3275, 13 October 2012 - 08:11 PM.
Posted 13 October 2012 - 08:04 PM
Edited by superman3275, 13 October 2012 - 08:12 PM.
Posted 14 October 2012 - 12:12 PM
Posted 14 October 2012 - 12:46 PM
Posted 14 October 2012 - 01:24 PM
You can make functions with the same names that grabs the values as needed which will give you equivalent readability. See also Don't Repeat Yourself (DRY).For the redundant computation: Later on in my code, in GameLogic/GameDraw especially, I have some code that would be almost impossible to read unless I have those variables.
You might want to get out of the habit of writing functions that are never used. See You Aren't Going to Need It (YAGNI).Also, GetImage() is never used, but that's a good idea.
Posted 14 October 2012 - 03:49 PM
void GameLogic::CheckCollision()
{
...
if (logic_ball->GetCollisionMgr()->Intersects(logic_board[index]) && LogicBoard[index]->GetIsHit() == false) {
...
logic_ball->UpdateVelocity(); // this func knows that GetCollisionMgr()->Intersects(...) have cached info about intersection and know how to apply velocity
}
...
Edited by AlexB.hpp, 14 October 2012 - 03:51 PM.
Posted 14 October 2012 - 07:21 PM
Edited by superman3275, 15 October 2012 - 02:35 PM.
Posted 14 October 2012 - 08:09 PM
Posted 14 October 2012 - 08:17 PM
Edited by Black-Rook, 14 October 2012 - 08:19 PM.
Posted 14 October 2012 - 08:34 PM
Posted 14 October 2012 - 08:43 PM
// /* */
// Add two values and return the sum
int Add(int a, int b)
{
return (a + b);
}/* This is all comment code! */
Posted 14 October 2012 - 08:58 PM
AlexB.hpp, considering your new to the forum I'm not going to get mad at you, but who are you to be talking like you're an expert in C++? It doesn't matter if pointers are more flexible then references, I don't need pointers and I don't plan to use their harder to understand syntax. Also, you should probably realize I AM USING A LIBRARY CALLED SFML AND OMG I'M USING BOUNDING BOX COLLISION. That's why I can't "refactor" my code, and that's probably why you don't understand this:
If you actually used SFML you would know what was going on. You also just signed up for the forum, so I suggest you stop telling people in the beginnersLogicBall->GetCollision().Intersects(LogicBoard[index]->GetTop())
section that their code is:this if is freaking terrible
I'm in the beginners section, do you expect "your" quality code.(That's considering your an actual developer, which I doubt you are.)
I'm saying that if Collision(A bounding box rectangle) intersects one of my blocks I set that block to being hit. If you knew what you were talking about you might understand that.
BUT,
Your interface Manager idea is smart, and I might implement it later. Thank you for your input, just please be less harsh on people in the beginners section.
Edited by Serapth, 14 October 2012 - 09:02 PM.
Posted 14 October 2012 - 09:28 PM
Board.resize(20); for (int index = 0; index < 20; ++index)
This code is officially dead, I'm going to try something simpler before attempting breakout again. My interface is awful (As the guy above pointed out), and I didn't plan my code at all. I'm going to try to become a better programmer by taking a smaller step, because I bit off more than I could chew.
Edited by ultramailman, 14 October 2012 - 09:31 PM.
Posted 15 October 2012 - 02:12 AM
AlexB.hpp, considering your new to the forum I'm not going to get mad at you, but who are you to be talking like you're an expert in C++? It doesn't matter if pointers are more flexible then references, I don't need pointers and I don't plan to use their harder to understand syntax. Also, you should probably realize I AM USING A LIBRARY CALLED SFML AND OMG I'M USING BOUNDING BOX COLLISION. That's why I can't "refactor" my code, and that's probably why you don't understand this:
If you actually used SFML you would know what was going on. You also just signed up for the forum, so I suggest you stop telling people in the beginnersLogicBall->GetCollision().Intersects(LogicBoard[index]->GetTop())
section that their code is:this if is freaking terrible
I'm in the beginners section, do you expect "your" quality code.(That's considering your an actual developer, which I doubt you are.)
I'm saying that if Collision(A bounding box rectangle) intersects one of my blocks I set that block to being hit. If you knew what you were talking about you might understand that.
BUT,
Your interface Manager idea is smart, and I might implement it later. Thank you for your input, just please be less harsh on people in the beginners section.
Posted 15 October 2012 - 02:36 PM
I'm sorry, it was late at night when I made that post. I guess I was annoyed because of all the time I had invested, and when you criticized me that harshly I just felt like all my work was for nothing.
AlexB.hpp, considering your new to the forum I'm not going to get mad at you, but who are you to be talking like you're an expert in C++? It doesn't matter if pointers are more flexible then references, I don't need pointers and I don't plan to use their harder to understand syntax. Also, you should probably realize I AM USING A LIBRARY CALLED SFML AND OMG I'M USING BOUNDING BOX COLLISION. That's why I can't "refactor" my code, and that's probably why you don't understand this:If you actually used SFML you would know what was going on. You also just signed up for the forum, so I suggest you stop telling people in the beginnersLogicBall->GetCollision().Intersects(LogicBoard[index]->GetTop())
section that their code is:this if is freaking terrible
I'm in the beginners section, do you expect "your" quality code.(That's considering your an actual developer, which I doubt you are.)
I'm saying that if Collision(A bounding box rectangle) intersects one of my blocks I set that block to being hit. If you knew what you were talking about you might understand that.
BUT,
Your interface Manager idea is smart, and I might implement it later. Thank you for your input, just please be less harsh on people in the beginners section.
Sozz dude, looks like I was a little bit mean.
I'm not an expert but I'm trying to get some experience too. So that's why I wanna give you a little review.
Would you agree if guys will give you some feedbacks on your code to improve it. Your code looks really difficult to understand.
Did you just begin or not, it doesn't matter, 'cause you HAVE to write good code.
Let me tell what I call good code. Good code - when you send it to another programmer with enough skill, he can understand and modify it after few hours of reading.
Sooo that's why I said that that some part of your code freak me out. But ofc your code can be OK.
My suggestion - keep dev it, 'cause you've got nice feedback on it.