def update_screen(game_settings, screen, player_render, aliens, bullets, play_button, stats, scoreboard): screen.fill(game_settings.background_color) for bullet in bullets.sprites(): bullet.draw_bullet() player_render.blitme() aliens.draw(screen) scoreboard.show_score() if not stats.game_active: play_button.draw_button() pygame.display.flip()
def update_screen(ai_settings, screen, ship, bullets, aliens, stats, play_button, sb, bg): screen.fill(ai_settings.bg_color) bg.blitme() for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) sb.show_score() if not stats.game_active: play_button.draw_button() pygame.display.flip()
def update_screen(set, screen, ship_1, bullets, aliens, stats, play_button, sb): screen.fill(set.background_color) # 更换屏幕颜色 ship_1.create_ship() # 不断的在新subface创建飞船 # for alien in aliens.sprites(): # alien.create_alien() aliens.draw(screen) # 因为对sprite函数的不了解,他默认调用的是类中的某个名字值,无他 sb.show_score() for bullet in bullets.sprites(): bullet.draw_bullet() check_aliens_bottom(screen, aliens, stats, bullets, ship_1, set, sb) if not stats.game_active: play_button.draw_button() pygame.display.flip() # 刷新
def update_screen(ai_setting, screen, ship, bullets, aliens, game_stats): """更新屏幕上的图片,并切换新屏幕,这里要用到三个参数""" #每次循环时都重绘屏幕 screen.fill(ai_setting.bg_color) ship.blitme() for bullet in bullets.sprites(): bullet.draw_bullet() aliens.draw(screen) """在屏幕上画出外星飞船群""" """更新飞船位置""" pygame.display.flip()
def update_screen(ai_settings, screen, ship, aliens, bullets, stats, play_button, scoreboard): """Update images on the screen and flip to the new screen.""" # Redraw the screen during each pass through the loop. screen.fill(ai_settings.bg_color) scoreboard.show_score() # Redraw all bullets behind ship and aliens. for bullet in bullets.sprites(): bullet.draw_bullet() aliens.draw(screen) ship.blitme() # Draw the play button if the game is inactive. if not stats.game_active: play_button.draw_button() # Make the most recently drawn screen visible. pygame.display.flip()
def update_screen(settings, screen, ship, aliens, bullets, stats, play_button, sb): '''更新屏幕图像、切换到新屏幕''' #每次更新重绘屏幕 screen.fill(settings.bg_color) #绘制飞船 ship.blitme() #绘制子弹 for bullet in bullets: bullet.draw_bullet() #绘制外星人 aliens.draw(screen) #显示记分牌 sb.show_score() #如果游戏未开始或已结束,绘制按钮 if not stats.game_active: play_button.draw_button() #最近绘制屏幕可见 pygame.display.flip()
def update_screen(ai_setting, screen, ship, aliens, bullets, game_status, play_button, scoreboard): """更新屏幕图像,并切换到新屏幕""" # 每次循环时都重绘屏幕 screen.fill(ai_setting.bg_color) # 在飞船和外星人后面重绘所有子弹 for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() # 对编组调用draw方法时,pygame自动绘制各个元素 aliens.draw(screen) # 如果游戏未开启,则显示按钮 if not game_status.game_active: play_button.draw_button() # 绘制记分牌 scoreboard.draw_score_board() # 让最近绘制的屏幕可见,营造平滑移动的效果 pygame.display.flip()
def update_screen(sett,window,ship,bullets): for bullet in bullets.sprites(): bullet.draw_bullet() window.fill(sett.bg) ship.blitme() pygame.display.flip()