Mercurial > fife-parpg
diff demos/rpg/scripts/actors/baseactor.py @ 516:d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Tue, 25 May 2010 21:41:59 +0000 |
parents | edf5c0cf52f3 |
children | c3a026cdd91b |
line wrap: on
line diff
--- a/demos/rpg/scripts/actors/baseactor.py Tue May 25 15:02:16 2010 +0000 +++ b/demos/rpg/scripts/actors/baseactor.py Tue May 25 21:41:59 2010 +0000 @@ -29,6 +29,10 @@ from fife import fife from fife.extensions.loaders import loadMapFile +ActorStates = {'IDLE':0, + 'WALK':1, + 'ATTACK':2} + class Actor(object): def __init__(self, gamecontroller, instancename, instanceid=None, createInstance=False): """ @@ -52,10 +56,13 @@ self._instance = None if createInstance: - self._createFIFEInstance(self._name) + self._createFIFEInstance() else: - self._instance = self._gamecontroller.scene.layer.getInstance(self._id) - self._instance.thisown = 0 + self._instance = self._gamecontroller.scene.actorlayer.getInstance(self._id) + self._instance.thisown = 0 + + self._walkspeed = self._gamecontroller.settings.get("RPG", "DefaultActorWalkSpeed", 4.0) + self._state = ActorStates["IDLE"] def destroy(self): """ @@ -64,6 +71,10 @@ if self._instance : self._gamecontroller.scene.actorlayer.deleteInstance(self._instance) self._instance = None + + def walk(self, location): + self._state = ActorStates["WALK"] + self._instance.move('walk', location, self._walkspeed) def _createFIFEInstance(self): """