Platformer controls

How do I code buttons to move a lil sprite for a platformer? (think of Super Mario Bros)

so, are you trying to make is so if you hit a button your ball goes up then slowly comes down until it collides with a sprite?