# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1278081687 0 # Node ID 872a7a94563ee0c15bfb3293038c161dc8503af0 # Parent 58c0bbeeeb352fcb01b81716b1532d39a2f58fdd - Updated the soundmanager extension to reflect changes made in last commit. - Made actor walk speed part of the ActorAttributes class. - The ActorAttributes class now gets serialized correctly. diff -r 58c0bbeeeb35 -r 872a7a94563e demos/rpg/scripts/actors/baseactor.py --- a/demos/rpg/scripts/actors/baseactor.py Fri Jul 02 06:02:21 2010 +0000 +++ b/demos/rpg/scripts/actors/baseactor.py Fri Jul 02 14:41:27 2010 +0000 @@ -106,17 +106,21 @@ self._object.performNextAction() class ActorAttributes(Serializer): - def __init__(self, strength=0, dexterity=0, intelligence=0, health=0): + def __init__(self, strength=0, dexterity=0, intelligence=0, health=0, walkspeed=0): self._str = strength self._dex = dexterity self._int = intelligence self._hp = health + self._walkspeed = walkspeed def serialize(self): + lvars = {} + lvars['str'] = self._str lvars['dex'] = self._dex lvars['int'] = self._int lvars['hp'] = self._hp + lvars['walk_speed'] = self._walkspeed return lvars @@ -129,6 +133,8 @@ self._int = int(valuedict['int']) if valuedict.has_key("hp"): self._hp = int(valuedict['hp']) + if valuedict.has_key("walk_speed"): + self._walkspeed = float(valuedict['walk_speed']) def _getStrength(self): return self._str @@ -154,11 +160,18 @@ def _setHealth(self, health): self._hp = health + def _getWalkSpeed(self): + return self._walkspeed + + def _setWalkSpeed(self, walkspeed): + self._walkspeed = walkspeed + strength = property(_getStrength, _setStrength) dexterity = property(_getDexterity, _setDexterity) intelligence = property(_getIntelligence, _setIntelligence) health = property(_getHealth, _setHealth) + walkspeed = property(_getWalkSpeed, _setWalkSpeed) class Actor(BaseGameObject): @@ -169,11 +182,12 @@ self._inventory = [] self._maxinventoryitems = 20 - self._walkspeed = self._gamecontroller.settings.get("RPG", "DefaultActorWalkSpeed", 4.0) - self._gold = 0 self._attributes = ActorAttributes() - + + #set the default walkspeed + self._attributes.walkspeed = self._gamecontroller.settings.get("RPG", "DefaultActorWalkSpeed", 4.0) + self.stand() def stand(self): @@ -182,7 +196,7 @@ def walk(self, location): self._state = ActorStates["WALK"] - self._instance.move('walk', location, self._walkspeed) + self._instance.move('walk', location, self._attributes.walkspeed) def say(self, text): self._instance.say(text, 2500) @@ -230,6 +244,10 @@ lvars['gold'] = self._gold + att_vars = self._attributes.serialize() + for key, value in att_vars.items(): + lvars[key] = value + return lvars def deserialize(self, valuedict): @@ -240,8 +258,7 @@ else: self._gold = 0 - if valuedict.has_key("walk_speed"): - self._walkspeed = float(valuedict['walk_speed']) + self._attributes.deserialize(valuedict) def _getState(self): return self._state diff -r 58c0bbeeeb35 -r 872a7a94563e engine/python/fife/extensions/soundmanager.py --- a/engine/python/fife/extensions/soundmanager.py Fri Jul 02 06:02:21 2010 +0000 +++ b/engine/python/fife/extensions/soundmanager.py Fri Jul 02 14:41:27 2010 +0000 @@ -239,7 +239,7 @@ else: fifeemitter = self._loadedclips[filename][0] - clip = SoundEmitter(self, fifeemitter.getID(), filename, fifeemitter) + clip = SoundEmitter(self, fifeemitter.getId(), filename, fifeemitter) clip.duration = fifeemitter.getDuration() if position is not None: @@ -361,7 +361,7 @@ for emitterlist in self._loadedclips.values(): for emitter in emitterlist: - self._fifesoundmanager.releaseEmitter(emitter.getID()) + self._fifesoundmanager.releaseEmitter(emitter.getId()) emitter = None self._loadedclips.clear()