comparison behaviours/moving.py @ 103:57f1cff9a75d

Added animation queue and method the base behaviour class.
author KarstenBock@gmx.net
date Fri, 30 Sep 2011 14:04:29 +0200
parents 2727d6b78978
children 04854cf6e1ac
comparison
equal deleted inserted replaced
102:2eb316546eae 103:57f1cff9a75d
58 self.idle_counter += 1 58 self.idle_counter += 1
59 59
60 def idle(self): 60 def idle(self):
61 """@return: None""" 61 """@return: None"""
62 BaseBehaviour.idle(self) 62 BaseBehaviour.idle(self)
63 self.agent.act('stand', self.agent.getFacingLocation()) 63 self.animate('stand')
64 64
65 def run(self, location): 65 def run(self, location):
66 """Makes the PC run to a certain location 66 """Makes the PC run to a certain location
67 @type location: fife.ScreenPoint 67 @type location: fife.ScreenPoint
68 @param location: Screen position to run to. 68 @param location: Screen position to run to.
69 @return: None""" 69 @return: None"""
70 self.state = base._AGENT_STATE_RUN 70 self.state = base._AGENT_STATE_RUN
71 self.clear_animations()
71 self.nextAction = None 72 self.nextAction = None
72 self.agent.move('run', location, self.speed + 1) 73 self.agent.move('run', location, self.speed + 1)
73 74
74 def walk(self, location): 75 def walk(self, location):
75 """Makes the PC walk to a certain location. 76 """Makes the PC walk to a certain location.
76 @type location: fife.ScreenPoint 77 @type location: fife.ScreenPoint
77 @param location: Screen position to walk to. 78 @param location: Screen position to walk to.
78 @return: None""" 79 @return: None"""
79 self.state = base._AGENT_STATE_RUN 80 self.state = base._AGENT_STATE_RUN
80 self.nextAction = None 81 self.clear_animations()
82 self.nextAction = None
81 self.agent.move('walk', location, self.speed - 1) 83 self.agent.move('walk', location, self.speed - 1)
82 84