def __init__(self, x, y, level, teleport=False): super(Goal, self).__init__() self._IMAGES = {"blue": engine.image_path("goal-blue.png"), "red": engine.image_path("goal-red.png")} self._current_color = random.choice(self._IMAGES.keys()) self.image = self._set_image() self.rect = self.image.get_rect().move(x, y) self._player_touch_done = 0 self.player_touch_required = 3 self._teleport = teleport self.level = level self._screen = pygame.display.get_surface() self._max_teleportable_x = self._screen.get_width() - self.rect.width
def __init__(self, x, y, level, teleport=False): super(Goal, self).__init__() self._IMAGES = { "blue": engine.image_path("goal-blue.png"), "red": engine.image_path("goal-red.png") } self._current_color = random.choice(self._IMAGES.keys()) self.image = self._set_image() self.rect = self.image.get_rect().move(x, y) self._player_touch_done = 0 self.player_touch_required = 3 self._teleport = teleport self.level = level self._screen = pygame.display.get_surface() self._max_teleportable_x = self._screen.get_width() - self.rect.width
def __init__(self, x, y, level): super(Octopus, self).__init__() self.image = pygame.image.load(engine.image_path("octopus.png")).convert_alpha() self.rect = self.image.get_rect().move(x, y) self.mask = pygame.mask.from_surface(self.image) self.level = level self.target = random.choice((self.level.red_player, self.level.blue_player)) self._screen = pygame.display.get_surface()
def __init__(self, x, y, level): super(Octopus, self).__init__() self.image = pygame.image.load( engine.image_path("octopus.png")).convert_alpha() self.rect = self.image.get_rect().move(x, y) self.mask = pygame.mask.from_surface(self.image) self.level = level self.target = random.choice( (self.level.red_player, self.level.blue_player)) self._screen = pygame.display.get_surface()
def __init__(self, x, y, image_filename): super(BasePlatform, self).__init__() self.image = pygame.image.load( engine.image_path(image_filename)).convert_alpha() self.rect = self.image.get_rect().move(x, y)
def __init__(self, x, y): super(FastFantom, self).__init__( x, y, [2, 2], engine.image_path("fast-fantom-to-left.png"), engine.image_path("fast-fantom-to-right.png"))
def __init__(self, x, y): super(SlowFantom, self).__init__( x, y, [1, 1], engine.image_path("slow-fantom-to-left.png"), engine.image_path("slow-fantom-to-right.png"))
def _set_image(self): image = "bird-0.png" if self._wings_up else "bird-1.png" surface = pygame.image.load( engine.image_path(image)).convert_alpha() return surface if self._to_right else pygame.transform.flip(surface, True, False)
def _set_image(self): return pygame.image.load( engine.image_path(self._image_filename())).convert_alpha()
def __init__(self): super(Red, self).__init__(engine.image_path("person-red.png"), x=50)
def __init__(self): super(Blue, self).__init__(engine.image_path("person-blue.png"), x=600)
def __init__(self, x, y, image_filename): super(BasePlatform, self).__init__() self.image = pygame.image.load(engine.image_path(image_filename)).convert_alpha() self.rect = self.image.get_rect().move(x, y)
def _set_image(self): return pygame.image.load(engine.image_path( self._image_filename())).convert_alpha()
def __init__(self, x, y): super(FastFantom, self).__init__(x, y, [2, 2], engine.image_path("fast-fantom-to-left.png"), engine.image_path("fast-fantom-to-right.png"))
def __init__(self, x, y): super(SlowFantom, self).__init__(x, y, [1, 1], engine.image_path("slow-fantom-to-left.png"), engine.image_path("slow-fantom-to-right.png"))
def _set_image(self): image = "bird-0.png" if self._wings_up else "bird-1.png" surface = pygame.image.load(engine.image_path(image)).convert_alpha() return surface if self._to_right else pygame.transform.flip( surface, True, False)