comparison gamescenecontroller.py @ 44:98f26f7636d8

Changes to make PARPG "runable" with grease. (With the correct modified assets)
author KarstenBock@gmx.net
date Tue, 06 Sep 2011 15:22:51 +0200
parents 3011bc71ab20
children d3a9caba067b
comparison
equal deleted inserted replaced
43:8f9e9f47c363 44:98f26f7636d8
238 if(data_drag.dragging): 238 if(data_drag.dragging):
239 coord = self.model.getCoords(scr_point)\ 239 coord = self.model.getCoords(scr_point)\
240 .getExactLayerCoordinates() 240 .getExactLayerCoordinates()
241 commands = ({"Command": "ResetMouseCursor"}, 241 commands = ({"Command": "ResetMouseCursor"},
242 {"Command": "StopDragging"}) 242 {"Command": "StopDragging"})
243 self.model.game_state.player_character.approach([coord.x, 243 self.model.game_state.getObjectById("PlayerCharacter").fifeagent.approach([coord.x,
244 coord.y], 244 coord.y],
245 DropItemAction(self, 245 DropItemAction(self,
246 data_drag.dragged_item, 246 data_drag.dragged_item,
247 commands)) 247 commands))
248 else: 248 else:
325 """Check if a command is to be executed 325 """Check if a command is to be executed
326 """ 326 """
327 if self.model.map_change: 327 if self.model.map_change:
328 self.pause(True) 328 self.pause(True)
329 if self.model.active_map: 329 if self.model.active_map:
330 player_char = self.model.game_state.player_character 330 player_char = self.model.game_state.getObjectById("PlayerCharacter").fifeagent
331 self.model.game_state.player_character = None 331 self.model.game_state.getObjectById("PlayerCharacter").fifeagent = None
332 pc_agent = self.model.agents[self.model.ALL_AGENTS_KEY]\ 332 pc_agent = self.model.agents[self.model.ALL_AGENTS_KEY]\
333 ["PlayerCharacter"] 333 ["PlayerCharacter"]
334 pc_agent.update(player_char.getStateForSaving()) 334 pc_agent.update(player_char.getStateForSaving())
335 pc_agent["Map"] = self.model.target_map_name 335 pc_agent["Map"] = self.model.target_map_name
336 pc_agent["Position"] = self.model.target_position 336 pc_agent["Position"] = self.model.target_position
344 344
345 self.model.setActiveMap(self.model.target_map_name) 345 self.model.setActiveMap(self.model.target_map_name)
346 self.model.readAgentsOfMap(self.model.target_map_name) 346 self.model.readAgentsOfMap(self.model.target_map_name)
347 347
348 self.model.placeAgents(self) 348 self.model.placeAgents(self)
349 self.model.placePC() 349 self.model.placePC(self)
350 self.model.map_change = False 350 self.model.map_change = False
351 # The PlayerCharacter has an inventory, and also some 351 # The PlayerCharacter has an inventory, and also some
352 # filling of the ready slots in the HUD. 352 # filling of the ready slots in the HUD.
353 # At this point we sync the contents of the ready slots 353 # At this point we sync the contents of the ready slots
354 # with the contents of the inventory. 354 # with the contents of the inventory.
409 # TODO: work more on this when we get NPCData and HeroData straightened 409 # TODO: work more on this when we get NPCData and HeroData straightened
410 # out 410 # out
411 npc = self.model.game_state.getObjectById(npc_info.ID, 411 npc = self.model.game_state.getObjectById(npc_info.ID,
412 self.model.game_state.\ 412 self.model.game_state.\
413 current_map_name) 413 current_map_name)
414 self.model.game_state.player_character.approach([npc.getLocation().\ 414 self.model.game_state.getObjectById("PlayerCharacter").fifeagent.approach([npc.getLocation().\
415 getLayerCoordinates().x, 415 getLayerCoordinates().x,
416 npc.getLocation().\ 416 npc.getLocation().\
417 getLayerCoordinates().y], 417 getLayerCoordinates().y],
418 TalkAction(self, npc)) 418 TalkAction(self, npc))
419 419
443 obj_id, obj.name, 443 obj_id, obj.name,
444 obj.text)]) 444 obj.text)])
445 # is it a Door? 445 # is it a Door?
446 if obj.trueAttr("door"): 446 if obj.trueAttr("door"):
447 actions.append(["Change Map", "Change Map", 447 actions.append(["Change Map", "Change Map",
448 self.model.game_state.player_character.approach, 448 self.model.game_state.getObjectById("PlayerCharacter").fifeagent.approach,
449 [obj.X, obj.Y], 449 [obj.X, obj.Y],
450 ChangeMapAction(self, obj.target_map_name, 450 ChangeMapAction(self, obj.target_map_name,
451 obj.target_pos)]) 451 obj.target_pos)])
452 # is it a container? 452 # is it a container?
453 if obj.trueAttr("container"): 453 if obj.trueAttr("container"):