Programming friction

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


On Wed, Jan 14, 2009 at 12:29 PM, killsto <kiliansto at gmail.com> 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?
> --
> http://mail.python.org/mailman/listinfo/python-list
>

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
direction.

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.

Cheers,

Jervis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090114/7da243b6/attachment.html>


More information about the Python-list mailing list