# HG changeset patch # User KarstenBock@gmx.net # Date 1315498986 -7200 # Node ID 62cff91a19cba63fdf90029661230b5de4109566 # Parent c25c734bd2a7eff24266bf0d7b633824c90fc75c Modifications to make the player agent move around by clicking with the mouse. diff -r c25c734bd2a7 -r 62cff91a19cb src/parpg/behaviours/base.py --- a/src/parpg/behaviours/base.py Thu Sep 08 15:18:39 2011 +0200 +++ b/src/parpg/behaviours/base.py Thu Sep 08 18:23:06 2011 +0200 @@ -109,4 +109,23 @@ @return: None""" self.state = _AGENT_STATE_TALK self.pc = pc.behaviour.agent - self.idle() \ No newline at end of file + self.idle() + + def run(self, location): + """Makes the PC run to a certain location + @type location: fife.ScreenPoint + @param location: Screen position to run to. + @return: None""" + self.state = _AGENT_STATE_RUN + self.nextAction = None + self.agent.move('run', location, self.speed + 1) + + def walk(self, location): + """Makes the PC walk to a certain location. + @type location: fife.ScreenPoint + @param location: Screen position to walk to. + @return: None""" + self.state = _AGENT_STATE_RUN + self.nextAction = None + self.agent.move('walk', location, self.speed - 1) + \ No newline at end of file diff -r c25c734bd2a7 -r 62cff91a19cb src/parpg/gamemodel.py --- a/src/parpg/gamemodel.py Thu Sep 08 15:18:39 2011 +0200 +++ b/src/parpg/gamemodel.py Thu Sep 08 18:23:06 2011 +0200 @@ -712,9 +712,9 @@ @param position: Screen position to move to @return: None""" if(self.pc_run == 1): - self.game_state.getObjectById("PlayerCharacter").fifeagent.run(position) + self.game_state.getObjectById("PlayerCharacter").fifeagent.behaviour.run(position) else: - self.game_state.getObjectById("PlayerCharacter").fifeagent.walk(position) + self.game_state.getObjectById("PlayerCharacter").fifeagent.behaviour.walk(position) def teleportAgent(self, agent, position): """Code called when an agent should teleport to another location diff -r c25c734bd2a7 -r 62cff91a19cb src/parpg/gamesceneview.py --- a/src/parpg/gamesceneview.py Thu Sep 08 15:18:39 2011 +0200 +++ b/src/parpg/gamesceneview.py Thu Sep 08 18:23:06 2011 +0200 @@ -62,7 +62,7 @@ def onWalk(self, click): """Callback sample for the context menu.""" self.hud.hideContainer() - self.model.game_state.getObjectById("PlayerCharacter").fifeagent.run(click) + self.model.game_state.getObjectById("PlayerCharacter").fifeagent.behaviour.run(click) def refreshTopLayerTransparencies(self): """Fade or unfade TopLayer instances if the PlayerCharacter