In fact, you could avoid most and why not all trigs by using vectors instead Ball to ball collision is almost as easy as ball to wall. the collision is (distance is smaller than cumulative radius) Ball to wall collision is generally done by point to line formula, but for simplication you could just test a single dimension component, x component for vertical walls and y component for horizontal.