Jump to content


Member Since 17 Jan 2004
Offline Last Active Aug 19 2013 11:52 PM

#5050810 Code Review ::Pong Clone::

Posted by RAZORUNREAL on 07 April 2013 - 03:11 AM

I haven't read the whole thing, but based on the ball class my main piece of advice would be this:

Try to reduce the number of conditions. The more similar code paths you have, the more opportunities there are for mistakes, particularly copy&paste errors. For example, rather than your 4 "moving..." booleans use a single velocity Vector2. You can add that to your position every update, avoiding 4 if statements. Then to bounce off the walls you just do velocity.x = -velocity.x