Mercurial > fife-parpg
comparison demos/rpg/scripts/actors/player.py @ 540:2e739ae9a8bc
Some misc code cleanup.
Added the EnterPortalAction action.
You can now move between town and level1.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 01 Jun 2010 19:17:30 +0000 |
parents | d0bce896a526 |
children | cb7ec12214a9 |
comparison
equal
deleted
inserted
replaced
539:4c7b5eee211c | 540:2e739ae9a8bc |
---|---|
25 # This is the rio de hola client for FIFE. | 25 # This is the rio de hola client for FIFE. |
26 | 26 |
27 import sys, os, re, math, random, shutil | 27 import sys, os, re, math, random, shutil |
28 | 28 |
29 from fife import fife | 29 from fife import fife |
30 from scripts.actors.baseactor import Actor, ActorStates | 30 from scripts.actors.baseactor import Actor, ActorStates, ActorActionListener |
31 from scripts.objects.baseobject import ObjectActionListener, BaseGameObject, GameObjectTypes | 31 from scripts.objects.baseobject import BaseGameObject, GameObjectTypes |
32 | 32 |
33 class PlayerActionListener(ObjectActionListener): | 33 class PlayerActionListener(ActorActionListener): |
34 def __init__(self, gamecontroller, obj): | 34 def __init__(self, gamecontroller, obj): |
35 super(PlayerActionListener, self).__init__(gamecontroller, obj) | 35 super(PlayerActionListener, self).__init__(gamecontroller, obj) |
36 | 36 |
37 def onInstanceActionFinished(self, instance, action): | 37 def onInstanceActionFinished(self, instance, action): |
38 super(PlayerActionListener, self).onInstanceActionFinished(instance, action) | 38 super(PlayerActionListener, self).onInstanceActionFinished(instance, action) |
39 if action.getId() == 'walk': | 39 if action.getId() == 'walk': |
40 pass | 40 pass |
41 #self._object.completeAction() | |
42 | 41 |
43 class Player(Actor): | 42 class Player(Actor): |
44 def __init__(self, gamecontroller, playermodelname): | 43 def __init__(self, gamecontroller, playermodelname): |
45 self._type = GameObjectTypes["PLAYER"] | 44 super(Player, self).__init__(gamecontroller, GameObjectTypes["PLAYER"], playermodelname, "player", True) |
46 super(Player, self).__init__(gamecontroller, playermodelname, "player", True) | |
47 self._playermodelname = playermodelname | 45 self._playermodelname = playermodelname |
48 | 46 |
49 self._playeractionlistener = PlayerActionListener(self._gamecontroller, self) | 47 self._actionlistener = PlayerActionListener(self._gamecontroller, self) |
48 self._actionlistener.attachActionListener() |