add the function of gravity