更新 'game_functions.py'

This commit is contained in:
206530211 2021-06-21 22:19:37 +08:00
parent b390ee3b91
commit ad2d4fe536
1 changed files with 9 additions and 1 deletions

View File

@ -48,4 +48,12 @@ def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens,
"""响应按键和鼠标事件""" """响应按键和鼠标事件"""
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
sys.exit() sys.exit()
elif event.type == pygame.KEYDOWN:
check_keydown_events(event, ai_settings, screen, ship, bullets)
elif event.type == pygame.KEYUP:
check_keyup_events(event, ship)
elif event.type == pygame.MOUSEBUTTONDOWN:
mouse_x, mouse_y = pygame.mouse.get_pos()
check_play_button(ai_settings, screen, stats, sb, play_button, ship,
aliens, bullets, mouse_x, mouse_y )