ship = Ship(pygame, screen) particle = Particle(pygame, screen,logic,0,0) handler = EventHandler() while clear(): for event in pygame.event.get(): if event.type == QUIT: sys.exit() elif event.type == pygame.KEYDOWN or event.type == pygame.KEYUP: handler.handle(event, pygame, screen, ship) elif event.type == END_MUSIC_EVENT and event.code == 0: sound.play() logic.hit_ship() if logic.win_game(): clear() menu.draw_winner(pygame,screen,logic.score) elif logic.is_game_over(): clear() menu.draw_loser(pygame, screen,logic.score) elif menu.started: menu.draw_score_and_lives(pygame,screen,logic.score,logic.lives,logic.level) if handler.keys['space']: if not particle.is_visible(): sound = pygame.mixer.Sound("laser.wav") sound.play() particle.start(ship) if handler.keys['right']: ship.move_right()