Implemented gravity and collision