Physics aside, I think the main issue here is the use of +/- and positive/negative values. Let 'dx' be positive for motion to the right, and negative for motion to the left. Therefore you want to subtract from dx for left motion, and add to it for right motion. But when you compute the new position,
you should always add; i.e., the position in the next frame is always x + dx. dx can be negative (meaning actually moving to the left), 0 (meaning stationary) or positive (meaning moving to the right.) If you're moving fast to the right, and you press left once, then you want dx to become somewhat less positive; we still are moving to the right, but slightly less fast. If there's no horizontal keypress at all, you want to continue to move just as fast to the right as before: you're in space and there's no horizontal damping. So the code could look like
[ December 09, 2008: Message edited by: Ernest Friedman-Hill ]