[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Weird problem



Kai Kuehne wrote:
Hi Luke,


On 10/14/06, Luke Paireepinart <rabidpoobear@xxxxxxxxx> wrote:
[Documentation]
HTH,
-Luke

Not really. Ok, maybe I'm a bit tired but I try to explain the real
problem I'm currently have (primarily in thinking, well could be also
time-related ;).
My real problem is how to move something slow and another thing
really fast if I set - let's say - the frame rate to 30. For the slow-thing
I could move it 1 pixel per frame. Ok, works great. And the fast-thing could
be moved 3 pixels per frame but than it looks not very cool. It's lagging
and you see the movement-steps. And what if the slow-thing is too fast, though?
I cannot set the speed to 0.5 because pygame.Rect uses integers for the
position things.


Probably (well, surely probably) this is a noob question. But atm,
I'm not getting to it...

Thanks
Kai


Part of the solution is to use speeds related to time instead of speeds related to frame rate.
This way your objects could go as slow as they want whatever the frame rate is.
AFAIK, If you want to have smooth movement, you need to code all your position and speed in float, that means using your own Rect module and using OpenGL or a lib that use it (see the pygame site).


Hope that helps,
L.