Mercurial > fife-parpg
diff demos/rpg/scripts/actors/baseactor.py @ 524:6037f79b0dcf
Multiple quests now work.
Added the item layer.
Made movement more like diablo by allowing you to hold and drag the left mouse button.
All objects are now loaded from a separate "allobjects" file. Specific item attributes are loaded from the map objects file (like position). This allows for the possibility of multiple instances using the same FIFE model.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 27 May 2010 21:11:37 +0000 |
parents | d01eb65b2726 |
children | 796d49ab9380 |
line wrap: on
line diff
--- a/demos/rpg/scripts/actors/baseactor.py Thu May 27 18:29:20 2010 +0000 +++ b/demos/rpg/scripts/actors/baseactor.py Thu May 27 21:11:37 2010 +0000 @@ -54,13 +54,16 @@ def execute(self): print "talking to: " + self._dest.instance.getId() - if self._dest.haveQuest(): - if not self._dest.activequest: - self._dest.offerNextQuest() + if self._dest.type == GameObjectTypes["QUESTGIVER"]: + if self._dest.haveQuest(): + if not self._dest.activequest: + self._dest.offerNextQuest() + else: + self._dest.completeQuest() else: - self._dest.completeQuest() + self._dest.instance.say("I've got nothing for you... leave me alone.", 2500) else: - self._dest.instance.say("I've got nothing for you... leave me alone.", 2500) + self._dest.instance.say("Hello there!") ActorStates = {'STAND':0, 'WALK':1, @@ -77,6 +80,10 @@ class Actor(BaseGameObject): def __init__(self, gamecontroller, instancename, instanceid=None, createInstance=False): + + if not hasattr(self, "_type"): + self._type = GameObjectTypes["NPC"] + super(Actor, self).__init__(gamecontroller, instancename, instanceid, createInstance) self._walkspeed = self._gamecontroller.settings.get("RPG", "DefaultActorWalkSpeed", 4.0) @@ -86,8 +93,6 @@ self._nextaction = None self.stand() - - self._type = GameObjectTypes["NPC"] def stand(self): self._state = ActorStates["STAND"] @@ -144,9 +149,9 @@ class QuestGiver(Actor): def __init__(self, gamecontroller, instancename, instanceid=None, createInstance=False): + self._type = GameObjectTypes["QUESTGIVER"] super(QuestGiver, self).__init__(gamecontroller, instancename, instanceid, createInstance) - self._type = GameObjectTypes["QUESTGIVER"] self._quests = [] self._activequest = None