Mercurial > fife-parpg
comparison demos/rpg/scripts/actors/baseactor.py @ 528:796d49ab9380
Cleaned up the createScene function.
Items can now be picked up.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 28 May 2010 14:52:56 +0000 |
parents | 6037f79b0dcf |
children | d0bce896a526 |
comparison
equal
deleted
inserted
replaced
527:79d5741fada6 | 528:796d49ab9380 |
---|---|
62 self._dest.completeQuest() | 62 self._dest.completeQuest() |
63 else: | 63 else: |
64 self._dest.instance.say("I've got nothing for you... leave me alone.", 2500) | 64 self._dest.instance.say("I've got nothing for you... leave me alone.", 2500) |
65 else: | 65 else: |
66 self._dest.instance.say("Hello there!") | 66 self._dest.instance.say("Hello there!") |
67 | |
68 class PickUpItemAction(BaseAction): | |
69 def __init__(self, actor, item): | |
70 self._actiontype = Actions['PICKUP'] | |
71 self._actor = actor | |
72 self._item = item | |
73 | |
74 def execute(self): | |
75 self._actor.pickUpItem(self._item) | |
67 | 76 |
68 ActorStates = {'STAND':0, | 77 ActorStates = {'STAND':0, |
69 'WALK':1, | 78 'WALK':1, |
70 'ATTACK':2} | 79 'ATTACK':2} |
71 | 80 |
104 | 113 |
105 def performNextAction(self): | 114 def performNextAction(self): |
106 if self._nextaction: | 115 if self._nextaction: |
107 self._nextaction.execute() | 116 self._nextaction.execute() |
108 self._nextaction = None | 117 self._nextaction = None |
118 | |
119 def pickUpItem(self, item): | |
120 self._inventory.append(item) | |
121 | |
122 #removes it from FIFE (to stop rendering the item) | |
123 item.destroy() | |
124 | |
125 #remove it from the scene | |
126 del self._gamecontroller.scene.objectlist[item.id] | |
109 | 127 |
110 def _getState(self): | 128 def _getState(self): |
111 return self._state | 129 return self._state |
112 | 130 |
113 def _setState(self, state): | 131 def _setState(self, state): |