comparison demos/rpg/scripts/objects/items.py @ 529:d0bce896a526

Changed the quest format in the object xml file. Quests can now required gold or items to complete.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 28 May 2010 16:25:00 +0000
parents 19db5a8619a4
children 2e739ae9a8bc
comparison
equal deleted inserted replaced
528:796d49ab9380 529:d0bce896a526
35 def __init__(self, gamecontroller, itemtype, itemname): 35 def __init__(self, gamecontroller, itemtype, itemname):
36 self._type = GameObjectTypes["ITEM"] 36 self._type = GameObjectTypes["ITEM"]
37 super(BaseItem, self).__init__(gamecontroller, itemtype, itemname, True) 37 super(BaseItem, self).__init__(gamecontroller, itemtype, itemname, True)
38 38
39 def onPickUp(self): 39 def onPickUp(self):
40 #remove item from the map 40 #remove item from the scene
41 self.destroy() 41 self._gamecontroller.scene.removeObjectFromScene(self)
42 42
43 def onDrop(self, dropx, dropy): 43 def onDrop(self, dropx, dropy):
44 #recreate object 44 #recreate object
45 self._createFIFEInstance(self, self._gamecontroller.scene.itemlayer) 45 self._createFIFEInstance(self, self._gamecontroller.scene.itemlayer)
46 self.setMapPosition(dropx, dropy) 46 self.setMapPosition(dropx, dropy)
47
48 self._gamecontroller.scene.addObjectToScene(self)
47 49
48 def _getItemType(self): 50 def _getItemType(self):
49 return self._name 51 return self._name
50 52
51 def _getItemName(self): 53 def _getItemName(self):
62 64
63 def _getValue(self): 65 def _getValue(self):
64 return self._value 66 return self._value
65 67
66 def _setValue(self, value): 68 def _setValue(self, value):
67 self._value = value 69 self._value = int(value)
68 70
69 value = property(_getValue, _setValue) 71 value = property(_getValue, _setValue)