add function of checking collison