added collision function for ball object