, , -,
import pygame
pygame.init()
gameDisplay = pygame.display.set_mode((800,600))
clock = pygame.time.Clock()
crashed = False
counter = 1
while not crashed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
pygame.display.update()
print(counter)
counter += 1
clock.tick(1)
, , , 1, 10, 10 . " ".
1 10 10 , 10 10 100 "duuh"
"1 fps", counter 10 " ", 10- 100
So, in short, we could say that the loop controls the display of your game and clock.tick () indicates how fast you want to change the display of the game in other words, how fast the loop works
source
share