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

Re: [pygame] Semi-Neophyte requires jerky animation assistance



I took Rene's suggestion and instead of using tick, I made my own method of ticking. It looks something like the following.

time0 = pygame.time.get_ticks()

stuff happens

time1 = pygame.time.get_ticks()
totaltime = time1 - time0

pygame.time.wait(16 - totaltime)

I used the wait function after pondering the documentation on Clock.tick(). I theorized that because Clock.tick() was using delay() and not freeing up the CPU for other processes the "jerk" was the system forcing a hold on my program so that other necessary processes could do their respective duties.

Testing my hypothesis proved fruitful, as using delay() instead of wait continued the "jerk" phenomena, while using wait() resulted in smooth animation.

The lesson? Let other processes have fun.

Thanks for all your help.

-Kevin Turner