更新 'game_functions.py'

This commit is contained in:
206530211 2021-06-22 10:49:29 +08:00
parent ce837ef768
commit 6036833285
1 changed files with 10 additions and 1 deletions

View File

@ -56,4 +56,13 @@ def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens,
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 )
aliens, bullets, mouse_x, mouse_y )
def check_play_button(ai_settings, screen, stats, sb, play_button, ship, aliens,
bullets, mouse_x, mouse_y):
"""在玩家单击Play按钮时开始新游戏"""
button_clicked = play_button.rect.collidepoint(mouse_x, mouse_y)
if button_clicked and not stats.game_active:
# 重置游戏设置
ai_settings.initialize_dynamic_settings()