Exemplo n.º 1
0
 def load_sprites(self):
     helper = SpritesHelper()
     self.image = pg.transform.scale(
         pg.image.load(helper.get_sprite('dark_elem', 'battle_idle')),
         (24, 36))
     self.image.set_colorkey(pg.Color("#fec5c5"))
     self.rect = self.image.get_rect()
Exemplo n.º 2
0
    def load_map_sprite(self):
        helper = SpritesHelper()
        image = pg.transform.scale(
            pg.image.load(helper.get_sprite('dark_elem', 'map')), (24, 36))
        image.set_colorkey(pg.Color("#fec5c5"))

        return image
Exemplo n.º 3
0
    def load_map_sprite(self):
        helper = SpritesHelper()
        image = pg.transform.scale(
            pg.image.load(helper.get_sprite('test', 'map')), (30, 38))
        image.set_colorkey(pg.Color("#7bd5fe"))

        return image
Exemplo n.º 4
0
    def load_sprites(self):
        """
        Loads sprites of player and npc characters and places them on screen, appends to sprites list
        """
        helper = SpritesHelper()
        image = pg.image.load(helper.get_bg(self.persist['bg']))
        rect = image.get_rect()
        rect.height = self.screen_height
        rect.width = self.screen_width
        image = pg.transform.scale(image, (self.screen_width, self.screen_height))
        self.bg = (image, rect)

        x = self.screen_width * 0.1
        y = self.screen_height * 0.3

        for i in self.npc_party:
            i.rect.x = x
            i.rect.y = y
            self.sprites.append((i.image, i.rect))
            y += i.rect.height + 10

        y = self.screen_height * 0.3
        x = self.screen_width * 0.8
        for i in self.player_party:
            i.battle_rect.x = x
            i.battle_rect.y = y
            self.sprites.append((i.battle_image, i.battle_rect))
            y += i.battle_rect.height + 10
Exemplo n.º 5
0
 def load_sprite(self):
     helper = SpritesHelper()
     self.image = pg.transform.scale(
         pg.image.load(helper.get_sprite('wizard', 'map')), (30, 38))
     self.image.set_colorkey(pg.Color("#7bd5fe"))
     self.rect = self.image.get_rect()
     self.rect.x = self.x
     self.rect.y = self.y
Exemplo n.º 6
0
 def __init__(self, persistent=None):
     super().__init__()
     self.font = pg.font.Font(None, 24)
     helper = SpritesHelper()
     splash_path = helper.get_sprite('splash', 'endgame')
     self.splash = pg.image.load(splash_path)
     self.splash_rect = self.splash.get_rect(center=self.screen_rect.center)
     self.bg = pg.Surface((self.screen_width, self.screen_height))
     self.bg.fill(pg.Color('black'))
Exemplo n.º 7
0
    def load_sprites(self):
        helper = Sprites()
        portrait_path = helper.get_sprite(self._res_name, 'portrait')
        portrait_image = pg.image.load(portrait_path)
        self.portrait = (portrait_image, portrait_image.get_rect())

        battle_path = helper.get_sprite(self._res_name, 'battle_idle')
        self.battle_image = pg.transform.scale(pg.image.load(battle_path),
                                               (30, 38))
        bg_color = "#7bd5fe"
        self.battle_image.set_colorkey(pg.Color(bg_color))
        self.battle_rect = self.battle_image.get_rect()
Exemplo n.º 8
0
 def animate_spell(self, target):
     """
     Called to create moving spell sprite
     """
     helper = SpritesHelper()
     image = pg.image.load(helper.get_sprite(self.last_action_func.name, "projectile"))
     image.set_colorkey(pg.Color("#7bd5fe"))
     rect = image.get_rect()
     rect.x = self.current_character.battle_rect.x
     rect.y = self.current_character.battle_rect.y
     target_rect = target.rect
     self.spell_anim = {'image': image,'rect': rect, 'target_rect': target_rect}
Exemplo n.º 9
0
 def load_animations(self):
     """
     Get all player animations paths
     :return: all player animations
     """
     helper = Sprites()
     anim_up_f = helper.get_animation('warrior', 'up')
     anim_down_f = helper.get_animation('warrior', 'down')
     anim_left_f = helper.get_animation('warrior', 'left')
     anim_right_f = helper.get_animation('warrior', 'right')
     anim_idle_f = [(anim_down_f[1], 0.1)]
     bg_color = "#7bd5fe"
     self.image.set_colorkey(pg.Color(bg_color))
     return anim_down_f, anim_idle_f, anim_left_f, anim_right_f, anim_up_f
Exemplo n.º 10
0
 def load_sprites(self):
     helper = SpritesHelper()
     self.image = pg.transform.scale(
         pg.image.load(helper.get_sprite('test', 'battle_idle')), (30, 38))
     self.image.set_colorkey(pg.Color("#7bd5fe"))
     self.rect = self.image.get_rect()