How do you use gravity in a javascript game?