存储项目的大部分函数
This commit is contained in:
parent
6b3b05364a
commit
5429100c85
|
@ -302,3 +302,13 @@ def ship_hit(ai_settings, screen, stats, sb, ship, aliens, bullets, bossalien, b
|
|||
pygame.mixer.init()
|
||||
sound = pygame.mixer.Sound('sounds/gameover.wav')
|
||||
sound.play()
|
||||
|
||||
|
||||
def check_aliens_bottom(ai_settings, screen, stats, sb, ship, aliens, bullets):
|
||||
"""检查是否有外星人到达了屏幕底端"""
|
||||
screen_rect = screen.get_rect()
|
||||
for alien in aliens.sprites():
|
||||
if alien.rect.bottom >= screen_rect.bottom:
|
||||
# 像飞船被撞到一样进行处理
|
||||
ship_hit(ai_settings, screen, stats, sb, ship, aliens, bossalien, bullets)
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue