Ejemplo n.º 1
0
def create_blacksmith(properties, i_store):
   if len(properties) == SMITH_NUM_PROPERTIES:
      return entities.Blacksmith(properties[SMITH_NAME],
         point.Point(int(properties[SMITH_COL]), int(properties[SMITH_ROW])),
         image_store.get_images(i_store, properties[PROPERTY_KEY]))
   else:
      return None
Ejemplo n.º 2
0
def create_new_entity(pt, entity_select, i_store):
   name = entity_select + '_' + str(pt.x) + '_' + str(pt.y)
   images = image_store.get_images(i_store, entity_select)
   if entity_select == 'obstacle':
      return entities.Obstacle(name, pt, images)
   elif entity_select == 'miner':
      return entities.MinerNotFull(name, MINER_LIMIT, pt,
         random.randint(MINER_RATE_MIN, MINER_RATE_MAX),
         images, MINER_ANIMATION_RATE)
   elif entity_select == 'vein':
      return entities.Vein(name,
         random.randint(VEIN_RATE_MIN, VEIN_RATE_MAX), pt, images)
   elif entity_select == 'ore':
      return entities.Ore(name, pt, images,
         random.randint(ORE_RATE_MIN, ORE_RATE_MAX))
   elif entity_select == 'blacksmith':
      return entities.Blacksmith(name, pt, images)
   else:
      return None