According to this statement, pygame.time.Clock().tick() should be called at the end of the main loop. However, I couldn't see any differences on my screen display regardless where I executed that method within the loop. Could someone please give some clarification on this? Thanks
Where should pygame.time.Clock().tick() be called in the script
119 Views Asked by Nemo At
2
There are 2 best solutions below
3
On
It is a common practise to place it at the end of the main loop, especially with respect to after flip or update. The documentation suggests
This method should be called once per frame. It will compute how many milliseconds have passed since the previous call.
It is thus a good practise to place it at after flip or update, which is usually done at the end of the main loop.
The documentation say :
So it is better to call it at the end of the loop because if you do it in the middle of your display fonction, a part of the element will be refresh before the wainting and a part after.You should call
pygame.display.update()before that otherwise you refresh the screen after the "frame wait time".