Added basic physics to movement

moving along the x-axis now gives a smooth acceleration and deceleration
instead of constant velocity. Collision detection works for the most
part but there is an annoying bug where the player stops a few pixels
farther from an object before where the actual collision should have
been detected.

The code is very messy right now and will need to be refactored later.