Collision detection in Java - The basics