예제 #1
0
 def __init__(self, icon, pos, option):
   pygame.sprite.Sprite.__init__(self)
   self.icon = icon
   self.idle = utils.load_image_trans("misc/s_button.png", (10,10))
   self.pressed = utils.load_image_trans("misc/s_button_push.png", (10, 10))
   self.image = self.idle
   self.rect = icon.get_rect()
   self.pos = pos
   self.rect.topleft = pos
   self.option = option
   self.status = 0
예제 #2
0
파일: force.py 프로젝트: Alberdi/sitoforce
 def __init__(self):
     pygame.sprite.Sprite.__init__(self)
     pygame.mouse.set_visible(0)
     self.name = "cursor"
     self.image = utils.load_image_trans("misc/cursor.png")
     self.rect = Rect(self.image.get_rect().left, self.image.get_rect().top, 1, 1)
     self.radius = 1
예제 #3
0
import utils
import unit

def xml_general(general, name):
  try:
    xmlsource = open(os.path.realpath("data/generals/" + name + ".xml"))
    xml = parse(xmlsource).getElementsByTagName("general")[0]
    xml.attributes = xml.getElementsByTagName("attributes")[0]
  except pygame.error, message:
    print 'Cannot load xml_general: '
    raise SystemExit, message

  #Global
  path = xml.getAttribute("path")
  general.name = xml.getAttribute("name")
  general.image = utils.load_image_trans(path + xml.getAttribute("imagesrc"))
  general.portrait = utils.load_image_trans(path + xml.getAttribute("image_portrait"))
  general.rect = general.image.get_rect()
  
  #Atributes
  general.health = int(xml.attributes.getAttribute("health"))
  general.damage = tuple(int(x) for x in xml.attributes.getAttribute("damage").split(","))
  general.speed = int(xml.attributes.getAttribute("speed"))
  general.base_accuracy = int(xml.attributes.getAttribute("accuracy"))
  general.attack_speed = int(xml.attributes.getAttribute("attack_speed"))
  general.dodge = int(xml.attributes.getAttribute("dodge"))
  
  #Traits
  general.traits = {}
  traits = xml.getElementsByTagName("traits")[0].getElementsByTagName("trait")
  for t in traits:
예제 #4
0
파일: minion.py 프로젝트: Alberdi/sitoforce
import utils
import unit

def xml_minion(minion, name):
  try:
     xmlsource = open("data/minions/" + name + ".xml")
     xml = parse(xmlsource).getElementsByTagName("minion")[0]
     xml.attributes = xml.getElementsByTagName("attributes")[0]
  except pygame.error, message:
    print 'Cannot load xml_minion: '
    raise SystemExit, message
  
  minion.name = xml.getAttribute("name")
  minion.imagesrc = xml.getAttribute("imagesrc")
  minion.image = utils.load_image_trans(minion.imagesrc)
  minion.rect = minion.image.get_rect()
  minion.health = int(xml.attributes.getAttribute("health"))
  minion.damage = tuple(int(x) for x in xml.attributes.getAttribute("damage").split(","))
  minion.speed = int(xml.attributes.getAttribute("speed"))
  minion.base_accuracy = int(xml.attributes.getAttribute("accuracy"))
  minion.attack_speed = int(xml.attributes.getAttribute("attack_speed"))
  minion.dodge = int(xml.attributes.getAttribute("dodge"))
      
class Minion(unit.Unit):
  def __init__(self, name, pos, side):
    unit.Unit.__init__(self)
    xml_minion(self, name)
    
    # We should order those initializations (alphabetically, for example)
    self.pos = pos