Added Gravity Functions

Copied the implementation from Spacewar2