コード例 #1
0
	def __init__(self, game, element):
		self.g = game.g
		objects.NPC.__init__(self, game, element) #initialize our parent
		self.vision = int(data.get_xml_prop(element, "vision")) #load properties
		self.reward = int(data.get_xml_prop(element, "reward"))
		self.class_name = data.get_xml_prop(element, "class")
		self.trainer_name = data.get_xml_prop(element, "name")
		self.pre_script = data.get_node(element, "pre_script")
		self.post_script = data.get_node(element, "post_script")
		#load spotted icon
		self.spotted_pic = data.load_image("objects/spotted.png")
		self.spotted_pic.convert_alpha()
		#get whether we have been fought or not
		self.fought = self.g.save.get_prop(self.id, "fought", False)
		self.moving = True
		self.seen = False #set if we've seen somebody
		self.move_data = [0, 0, 0] #store the movement we're going to do
		self.wait_time = 0 #amount of time to display icon
		#load party data
		party = []
		for node in data.get_node(element, "party").childNodes: #loop through pokemon
			if node.localName == "pokemon": #if it's a pokemon
				t = [node.getAttribute("type"), node.getAttribute("level")] #generate data
				party.append(t) #and save it
		self.party = party
コード例 #2
0
ファイル: trainer.py プロジェクト: defc0n1/pokeclone-1
 def __init__(self, game, element):
     self.g = game.g
     objects.NPC.__init__(self, game, element)  #initialize our parent
     self.vision = int(data.get_xml_prop(element,
                                         "vision"))  #load properties
     self.reward = int(data.get_xml_prop(element, "reward"))
     self.class_name = data.get_xml_prop(element, "class")
     self.trainer_name = data.get_xml_prop(element, "name")
     self.pre_script = data.get_node(element, "pre_script")
     self.post_script = data.get_node(element, "post_script")
     #load spotted icon
     self.spotted_pic = data.load_image("trainers/spotted.png")
     self.spotted_pic.convert_alpha()
     #get whether we have been fought or not
     self.fought = self.g.save.get_prop(self.id, "fought", False)
     self.moving = True
     self.seen = False  #set if we've seen somebody
     self.move_data = [0, 0, 0]  #store the movement we're going to do
     self.wait_time = 0  #amount of time to display icon
     #load party data
     party = []
     for node in data.get_node(element,
                               "party").childNodes:  #loop through pokemon
         if node.localName == "pokemon":  #if it's a pokemon
             t = [node.getAttribute("type"),
                  node.getAttribute("level")]  #generate data
             party.append(t)  #and save it
     self.party = party
コード例 #3
0
	def __init__(self, game, element):
		MapObj.__init__(self, game, element)
		properties = {}
		self.tile_x, self.tile_y = self.tile_pos
		#load destination properties
		dest_warp = data.get_xml_prop(element, "dest_warp")
		dest_map = data.get_xml_prop(element, "dest_map")
		if dest_warp is not None: #if there is a destination
			properties["dest_warp"] = dest_warp #store properties
			properties["dest_map"] = dest_map
			if self.sound: properties["sound"] = self.sound
		game.add_warp(tuple(self.tile_pos), properties) #add the warp
コード例 #4
0
ファイル: objects.py プロジェクト: davidnuon/pokeclone
 def __init__(self, game, element):
     self.g = game.g #store parameters
     self.game = game
     properties = {}
     #get tile we're monitoring
     t = element.getAttribute("pos").split(",")
     self.tile_x = int(t[0].strip())
     self.tile_y = int(t[1].strip())
     #load destination properties
     dest_warp = data.get_xml_prop(element, "dest_warp")
     dest_map = data.get_xml_prop(element, "dest_map")
     if dest_warp is not None: #if there is a destination
         properties["dest_warp"] = dest_warp #store properties
         properties["dest_map"] = dest_map
         game.add_warp((self.tile_x, self.tile_y), properties) #add the warp
     self.visible = False #we're not rendering anything
コード例 #5
0
ファイル: objects.py プロジェクト: davidnuon/pokeclone
 def __init__(self, game, element):
     self.game = game #store parameters
     self.text = data.get_xml_prop(element, "text") #store text to show
     #get our tile position
     t = element.getAttribute("pos").split(",")
     self.tile_pos = (int(t[0].strip()), int(t[1].strip())) #store position
     game.set_obj_pos(self, self.tile_pos) #set our position
     self.visible = False #we're not rendering anything
コード例 #6
0
 def __init__(self, game, element):
     self.game = game  #store parameters
     self.text = data.get_xml_prop(element, "text")  #store text to show
     #get our tile position
     t = element.getAttribute("pos").split(",")
     self.tile_pos = (int(t[0].strip()), int(t[1].strip()))  #store position
     game.set_obj_pos(self, self.tile_pos)  #set our position
     self.visible = False  #we're not rendering anything
コード例 #7
0
 def __init__(self, game, element):
     self.g = game.g  #store parameters
     self.game = game
     properties = {}
     #get tile we're monitoring
     t = element.getAttribute("pos").split(",")
     self.tile_x = int(t[0].strip())
     self.tile_y = int(t[1].strip())
     #load destination properties
     dest_warp = data.get_xml_prop(element, "dest_warp")
     dest_map = data.get_xml_prop(element, "dest_map")
     if dest_warp is not None:  #if there is a destination
         properties["dest_warp"] = dest_warp  #store properties
         properties["dest_map"] = dest_map
         game.add_warp((self.tile_x, self.tile_y),
                       properties)  #add the warp
     self.visible = False  #we're not rendering anything
コード例 #8
0
	def __init__(self, game, element):
		MapObj.__init__(self, game, element)
		self.text = data.get_xml_prop(element, "text") #store text to show
		#get our tile position
		game.set_obj_pos(self, self.tile_pos) #set our position
		self.dlog = dialog.Dialog(self.g, 'sign')