have you taken a physics class? if you did, think about how a force is broken up into components, and set the up component to the up key, the down component to the down key, and so on. and set this into a while loop.
if you don't know how to break it up into comonents i will help you out. but i will not spill my ball code just like that tho! it took me a while to figure it out!

Alex