I'm not sure exactly how to use gravity beyond this. The y position equals current position + speed. Speed equals speed + gravity.