功能函数更改

This commit is contained in:
206530314 2021-06-20 20:21:14 +08:00
parent 92281fab20
commit 8580ee5d7c
1 changed files with 22 additions and 0 deletions

View File

@ -324,3 +324,25 @@ def ship_aliens_hit(ai_settings, game_stats, scoreb, screen, ship, aliens, bulle
sleep(0.5)
def update_aliens(ai_settings, game_stats, scoreb, screen, ship, aliens, bullets):
"""
更新外星人群中所有外星人的位置
"""
check_fleet_edges(ai_settings, aliens)
aliens.update()
if pygame.sprite.spritecollideany(ship, aliens):
"""
接收俩个实参--检测飞船和外星人是否发生碰撞发生了---往下走没发生---返回None
"""
ship_aliens_hit(ai_settings, game_stats, scoreb, screen, ship, aliens, bullets)
# 检测是否有外星人到达屏幕底部
check_aliens_bottom(ai_settings, game_stats, scoreb, screen, ship, aliens, bullets)
def check_high_score(game_stats, scoreb):
"""检查是否诞生了新的最高得分"""
if game_stats.score > game_stats.high_score:
game_stats.high_score = game_stats.score
scoreb.prep_high_score()