存储项目的大部分函数
This commit is contained in:
parent
9757093adf
commit
e85cf00096
|
@ -134,4 +134,28 @@ def check_bullet_collisions(ai_settings, screen, stats, sb, ship, aliens, bossal
|
|||
if stats.level != stats.bosslevel - 1:
|
||||
create_fleet(ai_settings, screen, ship, aliens)
|
||||
else:
|
||||
pass
|
||||
pass
|
||||
# 增加:只有在BOSS关才启用
|
||||
elif stats.level == stats.bosslevel:
|
||||
|
||||
# 子弹击中BOSS外星人,BOSS外星人失去一定血量
|
||||
for bullet in bullets:
|
||||
if pygame.Rect.colliderect(bullet.rect, bossalien.rect):
|
||||
bossalien.health -= 100
|
||||
bullets.remove(bullet)
|
||||
|
||||
# 生命值为0时删除该BOSS
|
||||
if bossalien.health <= 0:
|
||||
# 提高等级,加分
|
||||
stats.level += 1
|
||||
sb.prep_level()
|
||||
stats.score += ai_settings.bossalien_points
|
||||
sb.prep_score()
|
||||
check_high_score(stats, sb)
|
||||
|
||||
create_fleet(ai_settings, screen, ship, aliens)
|
||||
|
||||
# BOSS发射子弹和船碰撞
|
||||
|
||||
if pygame.Rect.colliderect(bossbullet.rect, ship.rect):
|
||||
ship_hit(ai_settings, screen, stats, sb, ship, aliens, bullets, bossalien, bossbullet)
|
||||
|
|
Loading…
Reference in New Issue