存储项目的大部分函数
This commit is contained in:
parent
59428ed9e4
commit
ddf6acbfc0
|
@ -59,3 +59,32 @@ def check_events(ai_settings, screen, stats, sb, play_button, ship, aliens, bull
|
|||
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)
|
||||
def update_screen(ai_settings, screen, stats, sb, ship, aliens, bossalien, bullets, bossbullet, play_button):
|
||||
screen.fill(ai_settings.bg_color)
|
||||
ship.blitme()
|
||||
|
||||
# 在飞船和外星人后面重绘所有子弹
|
||||
for bullet in bullets.sprites():
|
||||
bullet.draw_bullet()
|
||||
|
||||
# 增加:如果进入BOSS关,则绘制BOSS外星人,其他关卡绘制普通外星人
|
||||
if stats.level == stats.bosslevel:
|
||||
bossalien.blitme()
|
||||
bossalien.draw_health_bar(screen)
|
||||
|
||||
bossbullet.draw_bullet()
|
||||
bossalien_fire_bullet(ai_settings, screen, bossalien, bossbullet, ship)
|
||||
|
||||
check_bossbullet_bottom(ai_settings, screen, stats, sb, ship, aliens, bossalien, bullets, bossbullet)
|
||||
else:
|
||||
aliens.draw(screen)
|
||||
|
||||
# 显示得分
|
||||
sb.show_score()
|
||||
|
||||
# 如果游戏处于非活动状态,就绘制Play按钮
|
||||
if not stats.game_active:
|
||||
play_button.draw_button()
|
||||
|
||||
# 让最近绘制的屏幕可见
|
||||
pygame.display.flip()
|
Loading…
Reference in New Issue