I decided just to recode the whole thing and now I have it all working. Here is my new code: http://pastie.org/5522782
And here is what it turns out to be:
when you click on the left, right, a, or d key you move across the x-axis, but you notice there's a small jump, then my hero shakes a little bit, then moves smoothly, how do I go about fixing this?
that stuttering movement is caused by your code and the way key listeners work. when you first press the left or right key and hold it down you call accel() but then accel is not called again until the keyboard's delay which varies by system but is about 500ms on my computer. so, for the first 500ms after pressing one of those keys you get left or right movement and then immediate braking because of your code:
1.5 1573 // <- right key pressed at 1573ms and held down
1 1589 // immediate slowing
1.5 2037 // keyboard delay expires and now repeated right key events are dispatched. this is when your hero moves as expected.
to remedy, use an enterframe loop it increment/decrement hSpeed, not the keyboard event. use a keydown and keyup listener to determine when to start and stop incrementing/decrementing hSpeed.