extracted out gravity to a function which effects an entity