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()
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
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
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
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
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'))
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()
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}
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
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()