Programming friction

killsto kiliansto at
Wed Jan 14 02:29:29 CET 2009

I'm trying to implement a basic user controlled sliding box with
pygame. I have everything worked out, except for two things.

The acceleration is changed once a second (for meters/second) this
leads to very jumpy movement. I need to add a way to check how long it
takes the program to loop and multiply the acceleration by that much.
(I think)

After I move, the box slows down appropriately, but then the speed
passes 0 and the box shoots off the other way. The equation (in real
life) is mS (Coefficient of static friction)*Normal Force >= friction
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?

More information about the Python-list mailing list