更新 'game_functions.py'
This commit is contained in:
parent
ce837ef768
commit
6036833285
|
@ -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()
|
Loading…
Reference in New Issue