def animate_party_hud_in(self, player, home, slots): """ Party HUD is the arrow thing with balls. Yes, that one. :param player: the player :type home: pygame.Rect :param slots: Number of slots :return: """ if self.get_side(home) == "left": tray = self.load_sprite('gfx/ui/combat/opponent_party_tray.png', bottom=home.bottom, right=0, layer=hud_layer) self.animate(tray.rect, right=home.right, duration=2, delay=1.5) centerx = home.right - scale(13) offset = scale(8) else: tray = self.load_sprite('gfx/ui/combat/player_party_tray.png', bottom=home.bottom, left=home.right, layer=hud_layer) self.animate(tray.rect, left=home.left, duration=2, delay=1.5) centerx = home.left + scale(13) offset = -scale(8) for index in range(slots): sprite = self.load_sprite('gfx/ui/combat/empty_slot_icon.png', top=tray.rect.top + scale(1), centerx=centerx - index * offset, layer=hud_layer) # convert alpha image to image with a colorkey so we can set_alpha sprite.image = tools.convert_alpha_to_colorkey(sprite.image) sprite.image.set_alpha(0) animate = partial(self.animate, duration=1.5, delay=2.2 + index * .2) animate(sprite.image, set_alpha=255, initial=0) animate(sprite.rect, bottom=tray.rect.top + scale(3))
def animate_party_hud_in(self, player, home): """ Party HUD is the arrow thing with balls. Yes, that one. :param player: the player :type home: pygame.Rect :param slots: Number of slots :return: """ if self.get_side(home) == "left": tray = self.load_sprite('gfx/ui/combat/opponent_party_tray.png', bottom=home.bottom, right=0, layer=hud_layer) self.animate(tray.rect, right=home.right, duration=2, delay=1.5) centerx = home.right - scale(13) offset = scale(8) else: tray = self.load_sprite('gfx/ui/combat/player_party_tray.png', bottom=home.bottom, left=home.right, layer=hud_layer) self.animate(tray.rect, left=home.left, duration=2, delay=1.5) centerx = home.left + scale(13) offset = -scale(8) for index in range(player.party_limit): sprite = None if len(player.monsters) > index: sprite = self.load_sprite( 'gfx/ui/icons/party/party_icon01.png', top=tray.rect.top + scale(1), centerx=centerx - index * offset, layer=hud_layer) else: sprite = self.load_sprite('gfx/ui/combat/empty_slot_icon.png', top=tray.rect.top + scale(1), centerx=centerx - index * offset, layer=hud_layer) # convert alpha image to image with a colorkey so we can set_alpha sprite.image = tools.convert_alpha_to_colorkey(sprite.image) sprite.image.set_alpha(0) animate = partial(self.animate, duration=1.5, delay=2.2 + index * .2) animate(sprite.image, set_alpha=255, initial=0) animate(sprite.rect, bottom=tray.rect.top + scale(3))
def func(): capdev.image = tools.convert_alpha_to_colorkey(capdev.image) self.animate(capdev.image, set_alpha=0, initial=255, duration=fade_duration)
def func(): capdev.image = tools.convert_alpha_to_colorkey(capdev.image) self.animate(capdev.image, set_alpha=0, initial=255, duration=fade_duration)