Beispiel #1
0
def powerup(sprite):
    flash = SquareSprite()
    flash.color = arcade.color.GOLD
    flash.position = sprite.position

    target = (sprite.center_x, sprite.center_y + 100)
    seq = Sequence()
    seq[0].frame = KeyFrame.from_sprite(sprite, ['position', 'scale', 'alpha'])
    seq[1].frame = KeyFrame(position=target, scale=1.5, alpha=0)
    seq[1].callback = flash.kill

    arcade.get_window().curtains.current_scene.flash_sprites.append(flash)
    return flash, seq
Beispiel #2
0
    def setup_widget(self, inverse=False):
        c = arcade.color
        bars = [('health', c.RED), ('stamina', c.BLUE), ('special', c.GREEN)]
        self.bars = {}

        for idx, (bar_name, color) in enumerate(reversed(bars)):
            container = Bar(arcade.color.WHITE, height=23, width=103)
            bar = Bar(color, inverse=inverse)
            bar.topleft = (50, idx * 25)
            container.position = bar.position
            self.sprites.extend([container, bar])
            self.bars[bar_name] = bar

        topleft = 0
        if inverse:
            topleft = 121

        padding = CircleSprite(size=80, color=c.SADDLE_BROWN)
        padding.topleft = (topleft, 55)

        portrait = CircleSprite(size=70, color=c.PERU)
        portrait.topleft = (topleft + 5, 50)

        backdrop = SquareSprite()
        backdrop.color = c.SADDLE_BROWN
        backdrop.width = 108
        backdrop.height = 85
        backdrop.position = self.bars['stamina'].position
        backdropleft = CircleSprite(size=85, color=c.SADDLE_BROWN)
        backdropleft.position = (backdrop.left, backdrop.center_y)
        backdropright = CircleSprite(size=85, color=c.SADDLE_BROWN)
        backdropright.position = (backdrop.right, backdrop.center_y)

        for sprite in [backdrop, backdropright, backdropleft]:
            self.sprites.insert(0, sprite)

        self.sprites.extend([padding, portrait])