Actually I changed self.clock.tick(60) to self.clock.tick(10) Actually is working out quiet well thanks :). Learned something new.
On 9/9/07, Lamonte Harris <[EMAIL PROTECTED]> wrote: > > I think its pygame.time.Clock(), yah it is. That doesn't work for me > though humm. I'll try the time.sleep then. > > On 9/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > On Sun, September 9, 2007 2:50 am, Lamonte Harris wrote: > > > It gets anoyying, but w/ my 384mb RAM I didn't expect it to take so > > much > > > cpu. 99% Some times. > > > > Generally, a Pygame program will run as fast as the OS lets it, which > > means very high CPU usage. If you want to use less, there are several > > methods. One of them is to "import time" and then, in the program's main > > > > loop, call "time.sleep(n)", where n is some fraction of a second. This > > method pauses the program in a way that lets other programs run. > > > > A more Pygame-focused method is to use Pygame's Clock class. Offhand I > > think it goes like this: > > > > clock = pygame.clock.Clock() > > [and then in the main loop:] > > clock.tick(desired_frame_rate) > > > > This second method is also good for maintaining a steady framerate -- > > useful for action games especially. There was some talk on this list > > earlier about a different method of maintaining a framerate more > > precisely > > at the cost of much more intense CPU use, but that's not what you want. > > > > If you want to see your program's framerate, use the "time" functions to > > > > get the time at the beginning of the program (or at some other point), > > compare that to the time at another point, and divide by the number of > > frames drawn. > > > > >