Esempio n. 1
0
 def __init__(self, element=None, comp=None, nescient=None, hexparams=get_hex_params(35)):
     if nescient != None:
         Nescient.__init__(self, nescient.element, nescient.comp, nescient.name,
                         nescient.weapon, nescient.location, nescient.facing, nescient.body)
     else:
         if element == None:
             element = rand_element()
         if comp == None:
             comp = rand_comp(suit=element, kind='Nescient')
         Nescient.__init__(self, comp=comp, element=element)
     
     pygame.sprite.Sprite.__init__(self)
     self.hexparams  = hexparams
     self.image = pygame.Surface((577, 560))
     self.hex = make_hex(self.hexparams, COLORS[self.element])
     self.body = None
     
     self.images = {'head':None, 'left':None, 'right':None, 'tail':None}
     self.rects  = {'head':None, 'left':None, 'right':None, 'tail':None}
     
     for part in self.images:
         #self.images[part] = make_hex(self.hexparams, COLORS[self.element], self.image)
         #self.rects[part]  = self.images[part].get_rect()
         self.rects[part]  = pygame.rect.Rect((0,0), self.hexparams[-1])
     self.rect = self.image.get_rect()
     self.image.set_colorkey(black)
     self.text = []
Esempio n. 2
0
 def __init__(self, element=None, comp=None, scient=None, hexparams=get_hex_params(35)):
     if scient != None:
         Scient.__init__(self, scient.element, scient.comp, scient.name,
                         scient.weapon, scient.weapon_bonus, scient.location)
     else:
         if element == None:
             element = rand_element()
         if comp == None:
             comp = rand_comp(suit=element, kind='Scient')
         Scient.__init__(self, comp=comp, element=element)
     pygame.sprite.Sprite.__init__(self)
     self.hexparams = hexparams
     r,s,hexh,rech,size = self.hexparams
     self.size = size
     self.image = pygame.Surface(size)
     self.image.fill(COLORS[self.element])
     self.image.fill(black)
     if self.weapon.type == 'Sword':
         x = r/2
         y = hexh
         self.rect = pygame.draw.polygon(self.image, COLORS[self.element], [(x, y), (x+s, y), (x+s, y+s), (x, y+s)]) #square
     elif self.weapon.type == 'Bow':
         self.rect = pygame.draw.circle(self.image, COLORS[self.element], ((size[0]/2) + 1, (size[1]/2) + 1), size[0]/2 - hexh/2) # cirlcle
     elif self.weapon.type == 'Wand':
         self.rect  = pygame.draw.polygon(self.image, COLORS[self.element], [(r+1,3), (2*r - 1 , rech-2*hexh), (r+1, rech-3), (2, rech - 2*hexh)])
     elif self.weapon.type == 'Glove':
         self.rect = pygame.draw.polygon(self.image, COLORS[self.element], [(r,2), (2*r-2, rech-hexh-1), (2, rech - hexh-1)]) # triangle
     self.image.set_colorkey(black)
     self.text = []
Esempio n. 3
0
def rand_unit(suit=None): #may change to rand_unit(suit, kind)
    """Returns a random Scient of suit. Random suit used if none given."""
    if not suit in ELEMENTS:
        suit = rand_element()
    return BattlePane.Scient(element=suit, comp=rand_comp(suit, 'Scient'))