Mercurial > parpg-source
comparison behaviours/player.py @ 30:ec5a55266f6a
Moved behaviours from objects/actors.py to files seperate files inside a behaviours directory.
author | KarstenBock@gmx.net |
---|---|
date | Mon, 05 Sep 2011 13:02:05 +0200 |
parents | |
children | 12071706020f |
comparison
equal
deleted
inserted
replaced
29:86799b61e5dc | 30:ec5a55266f6a |
---|---|
1 # This file is part of PARPG. | |
2 | |
3 # PARPG is free software: you can redistribute it and/or modify | |
4 # it under the terms of the GNU General Public License as published by | |
5 # the Free Software Foundation, either version 3 of the License, or | |
6 # (at your option) any later version. | |
7 | |
8 # PARPG is distributed in the hope that it will be useful, | |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 # GNU General Public License for more details. | |
12 | |
13 # You should have received a copy of the GNU General Public License | |
14 # along with PARPG. If not, see <http://www.gnu.org/licenses/>. | |
15 | |
16 from base import * | |
17 | |
18 class PlayerBehaviour (BaseBehaviour): | |
19 def __init__(self, parent=None, layer=None): | |
20 super(PlayerBehaviour, self).__init__(layer) | |
21 self.parent = parent | |
22 self.idle_counter = 1 | |
23 self.speed = 0 | |
24 self.nextAction = None | |
25 self.agent = None | |
26 | |
27 def onInstanceActionFinished(self, instance, action): | |
28 """@type instance: ??? | |
29 @param instance: ??? | |
30 @type action: ??? | |
31 @param action: ??? | |
32 @return: None""" | |
33 # First we reset the next behavior | |
34 act = self.nextAction | |
35 self.nextAction = None | |
36 self.idle() | |
37 | |
38 if act: | |
39 act.execute() | |
40 | |
41 if(action.getId() != 'stand'): | |
42 self.idle_counter = 1 | |
43 else: | |
44 self.idle_counter += 1 |