def cutscene7(): global level_five class Player(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.Surface((50, 50)) self.image.fill((0, 0, 0)) self.rect = self.image.get_rect(center=(400, 300)) def update(self, cut_scene_manager): if self.rect.centerx > 399: cut_scene_manager.start_cut_scene(CutSceneSeven(self)) if cut_scene_manager.cut_scene is None: pressed = pygame.key.get_pressed() if pressed[pygame.K_LEFT]: self.rect.x -= 5 if pressed[pygame.K_RIGHT]: self.rect.x += 5 def draw(self, screen): screen.blit(self.image, self.rect.center) player = Player() cut_scene_manager = CutSceneManager(screen) while True: mainClock.tick(60) # Events for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == KEYDOWN: if event.key == K_c: fade() cutscene8() # Update objects player.update(cut_scene_manager) cut_scene_manager.update() # Draw objects screen.fill((0, 0, 0)) draw_text('Press [c] to see changes', font, (255, 255, 255), screen, 20, 20) player.draw(screen) cut_scene_manager.draw() screen.blit(level_five, (50, 90)) pygame.display.flip()
def cutscene3(): global Earth_Stage1 class Player(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = pygame.Surface((50, 50)) self.image.fill((0, 0, 0)) self.rect = self.image.get_rect(center=(400, 300)) def update(self, cut_scene_manager): if self.rect.centerx > 399: cut_scene_manager.start_cut_scene(CutSceneThree(self)) if cut_scene_manager.cut_scene is None: pressed = pygame.key.get_pressed() if pressed[pygame.K_LEFT]: self.rect.x -= 5 if pressed[pygame.K_RIGHT]: self.rect.x += 5 def draw(self, screen): screen.blit(self.image, self.rect.center) player = Player() cut_scene_manager = CutSceneManager(screen) while True: mainClock.tick(60) # Events for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() sys.exit() if event.type == KEYDOWN: if event.key == K_c: level_2() # Update objects player.update(cut_scene_manager) cut_scene_manager.update() # Draw objects screen.fill((0, 0, 0)) player.draw(screen) cut_scene_manager.draw() screen.blit(Earth_Stage1, (300, 100)) pygame.display.flip()