Programming friction

Jervis Whitley jervisau at
Wed Jan 14 03:22:40 CET 2009

On Wed, Jan 14, 2009 at 12:29 PM, killsto <kiliansto at> wrote:

> force. So lets say I am slowing down at a rate of -2m/s^2, if I hit 1,
> the next number will be -1 and I shoot off in the other direction. How
> do I fix this an still have backwards movement?
> --

try something like:

force = max(force, 0)

where force is the force applied to the object that you have calculated.

this should ensure that the force is bounded to 0 in the negative

I believe that in pygame you can use the clock module to help you with your
timing issues (see the docs), and
perhaps attempt to keep a regular frame rate.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list