phc: key repeat + 30 fps event_loop

This commit is contained in:
Dmitry Belyaev 2024-04-01 00:09:37 +03:00
parent 81bebce3e9
commit 98a2e240e3

View File

@ -339,7 +339,7 @@ class Hero(GameObject):
if not self.active:
return
wide, short = 30, 5
wide, short = 10, 2
if event.type == pygame.KEYDOWN:
match event.key:
case pygame.K_UP:
@ -646,11 +646,14 @@ class Scene(GameObject):
self.end.handle_event(event)
def event_loop(self):
clock = pygame.time.Clock()
pygame.key.set_repeat(50, 30)
while not self.done:
event = pygame.event.wait()
self.handle_event(event)
for event in pygame.event.get():
self.handle_event(event)
self.draw()
pygame.display.flip()
clock.tick(30)
def game(assets):