I've played around a bit with Roger, testing different speeds and animation speeds.
My conclusions so far:
Speed sets the amount of pixels the character moves between two walk-cycle frames.
Ideally, this number is chosen before drawing the walk-cycle; feet touching the ground should move this very number of pixels between frames to avoid gliding/moonwalking.
Values from 4 (many frames) to 8 (few frames) seem to give good results (low-res games).
Once the speed setting has been established, leave it alone! To change the character's velocity, use animation speed only.
Animation speed sets the time in game-cycles (1/40s normally) between two walk-cycle frames.
Let's say you want the main character to move at a speed of v=100px/s. (That way it'll take him 3 seconds to cross a 320-screen, which is a reasonable time, IMO.)
And let's say we set the speed (frame-to-frame-distance) to s=5.
Then the animation speed is: (s*40)/v=(5*40)/100, which evaluates to 2.
Or in general: animation speed = (speed * gamecyles per second) / desired velocity in px/s.
So: Every animationspeed gamecycles, the character moves speed pixels and the next walk-cycle frame is displayed.
Phew. Hope this helps.
Edit: It's funny that neither speed nor animation speed are actually speeds. The former is a distance, the latter's an amount of time
My conclusions so far:
Speed sets the amount of pixels the character moves between two walk-cycle frames.
Ideally, this number is chosen before drawing the walk-cycle; feet touching the ground should move this very number of pixels between frames to avoid gliding/moonwalking.
Values from 4 (many frames) to 8 (few frames) seem to give good results (low-res games).
Once the speed setting has been established, leave it alone! To change the character's velocity, use animation speed only.
Animation speed sets the time in game-cycles (1/40s normally) between two walk-cycle frames.
Let's say you want the main character to move at a speed of v=100px/s. (That way it'll take him 3 seconds to cross a 320-screen, which is a reasonable time, IMO.)
And let's say we set the speed (frame-to-frame-distance) to s=5.
Then the animation speed is: (s*40)/v=(5*40)/100, which evaluates to 2.
Or in general: animation speed = (speed * gamecyles per second) / desired velocity in px/s.
So: Every animationspeed gamecycles, the character moves speed pixels and the next walk-cycle frame is displayed.
Phew. Hope this helps.
Edit: It's funny that neither speed nor animation speed are actually speeds. The former is a distance, the latter's an amount of time
