added logic to handle player collision