def on_render(self): self._display_surf.fill(BLACK) for row in self.map.tile_map: for item in row: self._display_surf.blit(item.sprite, (item.posx, item.posy)) self.score.update(self._display_surf) if not self.score.is_time_left(): MusicPlayer.play_music(Music.MUSIC_END) sleep(10) self.on_init()
def on_execute(self): self.on_init() while self._running: self.clock.tick(FPS) for event in pygame.event.get(): self.on_event(event) self.on_loop() self.on_render() pygame.display.flip() if self.map.game_won: self.score.display_end_screen(self._display_surf) pygame.display.flip() MusicPlayer.play_music(Music.MUSIC_VICTORY) sleep(14) self._running = False self.on_cleanup()