I don't know what source you're modifying but collision detection can be easy and it can be difficult. For the sake of simplicity, I assume that you're doing 2d collisions and not 3d. I can't help you with potential functionality built-in to the code to use, but I can help I suppose.
I would...