功能函数更改
This commit is contained in:
parent
92281fab20
commit
8580ee5d7c
|
@ -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()
|
Loading…
Reference in New Issue