What have you tried so far? What do you have working? Where are you stuck?

There are countless ways to detect a collision, if that is indeed what you're asking about. Try to do a google search on...