def __init__(self, data, size_x, size_y, nb_sprite, sheet_height, posx, posy, x, y, name, damage, who_cast, cooldown=1000): NewSprite.__init__(self, size_x, size_y, posx, posy) self.group_sprite = fc.group_my_spritesheet(data, size_y, size_x, nb_sprite, sheet_height) self.nb_sprite = nb_sprite self.direction_x = x*4 self.direction_y = y*4 self.cooldown = cooldown self.damage = damage self.who_cast = who_cast Spell.time_to_cast = self._cooldown(name)
def __init__(self, data, sizex, sizey, nb_sprite, sheetsize, posx=0, posy=0): NewSprite.__init__(self, sizex, sizey, posx, posy) self.group_sprite = fc.group_my_spritesheet(data, sizey, sizex, nb_sprite, sheetsize) self.nb_sprite = nb_sprite self.hero = fc.load_hero() # recover champion 's data self.desc = ma.panel[self.hero["Level"]-1] # -1 because of a shift in the panel self.stats = {"HP": self.desc["HP"][self.hero["Classes"]], "MP": self.desc["MP"][self.hero["Classes"]], "Armor": self.desc["Armor"][self.hero["Classes"]]} # fetch data according to the champion's role self.hp_bar = pg.Rect(self.posx, self.posy-10, int((self.stats["HP"] / self.desc["HP"][self.hero["Classes"]]) * 30), 6) # create a rectangle for the character's HP (( current HP / FULL HP) * SIZE_IN_PIXEL) self.alive = True