implement collision using Rectangle class