• Create Account

### #ActualAlexB.hpp

Posted 14 October 2012 - 03:51 PM

GameLogic::CheckCollision() -- this if is freaking terrible. After 10 minutes reading I don't get it.
Why do you every time repeat this GetIsHit()? And also this freaking LogicBall->GetCollision().Intersects(LogicBoard[index]->GetTop())... It would be nice to refactore it to

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
}
...


I hope I've gave you some ideas about how to improve your code.

And also I suggest you to use pointers instead of references. It's a little bit flexible.

### #1AlexB.hpp

Posted 14 October 2012 - 03:49 PM

GameLogic::CheckCollision() -- this if is freaking terrible. After 10 minutes reading I don't get it.
Why do you every time repeat this GetIsHit()? And also this freaking LogicBall->GetCollision().Intersects(LogicBoard[index]->GetTop())... It would be nice to refactore it to

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
}
...


I hope I've gave you some ideas about how to improve your code.

PARTNERS