Any method that requires multiple checking per movement will slow the system down at some point. My method (which will work in any 2D space) has a lower impact.