phc: key repeat + 30 fps event_loop
This commit is contained in:
parent
81bebce3e9
commit
98a2e240e3
@ -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()
|
||||
for event in pygame.event.get():
|
||||
self.handle_event(event)
|
||||
self.draw()
|
||||
pygame.display.flip()
|
||||
clock.tick(30)
|
||||
|
||||
|
||||
def game(assets):
|
||||
|
Loading…
Reference in New Issue
Block a user