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

Re: [pygame] Clock Tickings



On Tue, 22 Jan 2008 15:49:10 +0000, "Chris Smith" <maximinus@xxxxxxxxx>
wrote:
> In the pygame docs it heavily implies that, having a loop like:
> 
> clock=pygame.Clock()
> while(True):
>     clock.tick(1000/X)
> 
> Will let you control the framerate, X being the FPS (I know, dependant on
> a
> few other things). However, I'm getting the opposite effect - a low value
> of
> X gives me a high frame rate, and visa versa. Anyone have a handle on
> what's
> happening here?


As I understand it, the clock.tick() function takes your desired framerate
as its parameter, so the line should simply be "clock.tick(x)". You might
have the function confused with time.sleep(), which takes a desired _delay_
(in milliseconds) as its parameter.