I don't think I could explain it very well in words, so here is how to code some simple and (mostly) reliable collision.
Requested by @OldSchoolGarbage