def draw(log): """ Draws everything and updates the changes in the screen """ screen = environment.DISPLAY_SURFACE picasso.draw_background(screen) picasso.draw_hero(screen, game_state.hero) for pewpew in game_state.projectile_list: if not pewpew.is_out_of_screen(): picasso.draw_pewpew(screen, pewpew) for pickup in game_state.pickup_list: picasso.draw_pickup(screen, pickup) if game_state.hero.is_firing_laser: picasso.draw_laser(screen, game_state.hero.laser) for enemy in game_state.enemy_list: picasso.draw_enemy(screen, enemy) picasso.draw_bar(screen, enemy.bar) picasso.draw_bar(screen, game_state.hero_bar, hero_bar=True) picasso.draw_score(screen, game_state.score) pygame.display.update()
def end_game(log): if game_state.game_over: surf = environment.DISPLAY_SURFACE picasso.draw_background(surf) surf.blit(environment.GAME_OVER_TEXT,(environment.WINDOW_WIDTH/4,environment.WINDOW_HEIGHT/2)) surf.blit(environment.PROMPT_TEXT,(environment.WINDOW_WIDTH/4,environment.WINDOW_HEIGHT*(3.0/4.0))) pygame.display.update() while game_state.game_over: handle_input(log, game_state.game_over) if game_state.win: picasso.draw_background(surf) surf.blit(environment.WIN_TEXT,(environment.WINDOW_WIDTH/8,environment.WINDOW_HEIGHT/2)) surf.blit(environment.PROMPT_TEXT,(environment.WINDOW_WIDTH/4,environment.WINDOW_HEIGHT*(3.0/4.0))) pygame.display.update() while game_state.win: handle_input(game_state.win)