def update_screen(ai_settings,screen,ship): """Update images on the screen and flip to the new screen""" ship.blitme() screen.fill(ai_settings.bg_color) # Make the most recently drawn screen visible pygame.display.flip
def update_screen(ai_settings, screen, stats, sb, ship, aliens, bullets, play_button): screen.fill(ai_settings.bg_color) sb.show_score() if not stats.game_active: play_button.draw_button() for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) pygame.display.flip()
def update_screen(ai_settings,screen,ship,aliens,bullets): #每次循环重新绘制屏幕 screen.fill(ai_settings.bg_color) for bullet in bullets: bullet.draw_bullet() ship.blitme() #alien.blitme() aliens.draw(screen) #让绘制的屏幕可见 pygame.display.flip()
def update_screen(ai_settings,screen,ship, aliens, bullets): """更新屏幕并且切换到新的屏幕""" # 每次循环时都要重绘屏幕 screen.fill(ai_settings.bg_color) # 在飞船和外星人后面重绘所有子弹 for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) # 让最近绘制的屏幕可见 pygame.display.flip()
def update_screen(ai_settings, screen, ship, aliens, bullets): """Update the screen during each pass through the loop""" screen.fill(ai_settings.bg_color) for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) alien.blitme() 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): """Update images on the screen and flip to the new screen. :type alien: object """ # Redraw the screen during each pass through the loop. screen.fill(ai_settings.bg_color) # Redraw all bullets behind ship and aliens. for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) # Make the most recently drawn screen visible. pygame.display.flip()
def update_screen(ai_settings, screen, stats, sb, ship, aliens, bullets, play_button): """Оновлює зображення на екрані і відображає новий екран""" # Прикаждом переходе цыкла перерисовывается экран screen.fill(ai_settings.bg_color) # All bullets getting off behind image of ship and aliens for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) # Show score sb.show_score() # Button Play showing in case if game is not active if not stats.game_active: play_button.draw_button() # Отображение последнего прорисованого экрана pygame.display.flip()
def update_screen(ai_settings,screen,ship): #更新屏幕上的图像,并切换到新屏幕 # if ship.moving_right == True: # ship.rect.centerx +=1 # if ship.moving_left == True: # ship.rect.centerx -=1 # if ship.moving_up == True: # ship.rect.centery -=1 # if ship.moving_down == True: # ship.rect.centery +=1 ship.move() #每次循环都重绘屏幕 screen.fill(ai_settings.bg_color) ship.blitme() #让最近绘制的屏幕可见 pygame.display.flip()
def refresh_screen(ai_settings,screen,ship,fleet,bullets,play_button,stats,sb): """Redraw the screen during each pass through the loop - With bg color or with a bg image""" # screen.fill(ai_settings.bg_color) screen.blit(ai_settings.bg_image, (0,0)) # Draw bullets for bullet in bullets.sprites(): bullet.draw_bullet() # Draw Ship ship.blitme() # Draw Empire Fleet fleet.draw(screen) # Draw the score information. sb.show_score() # Set Button if game inactive if not stats.game_active: play_button.draw_button() # Make the most recently drawn screen visible. pygame.display.flip()
def update_screen(ai_settings, screen, stats, sb, play_button, ship, aliens, bullets): # Update images on the screen and flip to the new screen # Redraw the screen during each pass thorugh the loop screen.fill(ai_settings.bg_color) # Redraw all bullets behind ship and aliens. for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) # Draw the score information. sb.show_score() # 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(ai_settings, screen, stats, sb, ship, aliens, bullets, play_button): """更新屏幕上的图像,并切换到新屏幕""" # 每次循环都重绘屏幕 screen.fill(ai_settings.bg_color) # 在飞船和外星人后面重绘所有子弹 for bullet in bullets.sprites(): bullet.draw_bullet() ship.blitme() aliens.draw(screen) # 显示得分 sb.show_score() # 如果游戏处于非活动状态,就绘制Play按钮 if not stats.game_active: play_button.draw_button() # 让最近绘制的屏幕可见 pygame.display.flip()
def update_screen(ai_settings, screen, ship): screen.fill(ai_settings.bg_color) ship.blitme() pygame.display.flip()
bg_color(230, 230, 230) alien = Alien(ai_settings, screen) while True: gf.check_events(ai_settings, screen, ship, bullets) ship.update() gf.update_bullets(bullets) gf.update_aliens(aliens) gf.update_screen(ai_settings, screen, ship, alien, bullets) screen.fill(ai_settings.bg_color) ship.blitme() for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() pygame.display.flip() run_game()