Changeset 197
- Timestamp:
- 07/09/09 22:54:01 (10 years ago)
- Location:
- trunk/PARPG/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/PARPG/scripts/objects/actors.py
r188 r197 16 16 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. 17 17 import fife 18 from scripts import world 18 19 from base import * 19 20 … … 46 47 def getY(self): 47 48 """Get the NPC's y position on the map. 48 @rtype: integer49 s @rtype: integer 49 50 @return: the y coordinate of the NPC's location""" 50 51 return self.agent.getLocation().getLayerCoordinates().y … … 62 63 self.idlecounter = 1 63 64 self.speed = float(TDS.readSetting("PCSpeed")) # TODO: rework/improve 65 self.nextAction = None 66 self.examineName = None 67 self.examineDesc = None 64 68 65 69 def onInstanceActionFinished(self, instance, action): … … 71 75 if action.getId() == 'approachDoor': 72 76 # issue map change 73 self. parent.engine.changeMap(self.targetMap, self.targetLocation)77 self.engine.changeMap(self.targetMap, self.targetLocation) 74 78 if self.state == _AGENT_STATE_TALK: 75 79 # TODO: do something 76 80 pass 81 if self.nextAction == "open_box": 82 self.engine.view.createBoxGUI() 83 self.nextAction = None 84 elif self.nextAction == "examine_obj": 85 self.engine.view.createExamineBox(self.examineName, self.examineDesc) 86 self.nextAction = None 87 77 88 self.idle() 78 89 if(action.getId() != 'stand'): … … 124 135 self.state = _AGENT_STATE_RUN 125 136 self.behaviour.agent.move('run', location, self.behaviour.speed) 126 137 127 138 def approachNPC(self, npcLoc): 128 139 """Approaches an npc and then ???. … … 167 178 l.setLayerCoordinates(fife.ModelCoordinate(*boxLocation)) 168 179 self.behaviour.agent.move('run', l, self.behaviour.speed) 169 self.atBox = True 180 self.behaviour.nextAction = "open_box" 181 182 def approachAndExamine(self, location, name, description): 183 """ 184 Approach something and then examine it 185 @type location: list 186 @param location: list that is converted to fife.Location 187 @type name: string 188 @param name: The name of the object 189 @type description: string 190 @param description: a detailed description of the object 191 @return: None 192 """ 193 self.state = _STATE_RUN 194 objLocation = tuple([int(float(i)) for i in location]) 195 l = fife.Location(self.agent.getLocation()) 196 l.setLayerCoordinates(fife.ModelCoordinate(*objLocation)) 197 self.behaviour.nextAction = "examine_obj" 198 self.behaviour.examineName = name 199 self.behaviour.examineDesc = description 200 self.behaviour.agent.move('run', l, self.speed) 170 201 171 202 class NPCBehaviour(ActorBehaviour): -
trunk/PARPG/scripts/world.py
r189 r197 416 416 if ((self.boxCreated == True) and (self.boxOpen == False)): 417 417 # if it has already been created, just show it 418 print 'show' 418 419 self.box_container.showContainer() 419 420 self.boxOpen = True 420 421 else: 422 print 'create' 421 423 # otherwise create it then show it 422 self.box_container = ContainerGUI(self.engine, unicode("Box"), " gui/inv_images/inv_backpack.png")424 self.box_container = ContainerGUI(self.engine, unicode("Box"), "dagger01") 423 425 def close_and_delete(): 424 426 self.box_container.hideContainer()
Note: See TracChangeset
for help on using the changeset viewer.