added a collision function and movement function