source: trunk/PARPG/scripts/agents/hero.py @ 67

Revision 67, 882 bytes checked in by maximinus_parpg, 11 years ago (diff)

All code now PEP-8 standard, with spaces

Line 
1from agent import Agent
2from settings import Setting
3
4TDS = Setting()
5_STATE_NONE, _STATE_IDLE, _STATE_RUN = xrange(3)
6
7class Hero(Agent):
8    """This is the class we use for the PC character"""
9    def __init__(self, agentName, layer):
10        super(Hero, self).__init__(agentName, layer)
11        self.state = _STATE_NONE
12        self.idlecounter = 1
13        self.speed = float(TDS.readSetting("PCSpeed"))
14
15    def onInstanceActionFinished(self, instance, action):
16        self.idle()
17        if(action.getId() != 'stand'):
18            self.idlecounter = 1
19        else:
20            self.idlecounter += 1
21
22    def start(self):
23        self.idle()
24
25    def idle(self):
26        self.state = _STATE_IDLE
27        self.agent.act('stand', self.agent.getFacingLocation())
28
29    def run(self, location):
30        self.state = _STATE_RUN
31        self.agent.move('run', location, self.speed)
32
Note: See TracBrowser for help on using the repository browser.