Mercurial > fife-parpg
comparison demos/rpg/scripts/objects/items.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 | b6bd314df28a |
children | 19db5a8619a4 |
comparison
equal
deleted
inserted
replaced
523:d01eb65b2726 | 524:6037f79b0dcf |
---|---|
31 from scripts.objects.baseobject import BaseGameObject, GameObjectTypes | 31 from scripts.objects.baseobject import BaseGameObject, GameObjectTypes |
32 | 32 |
33 | 33 |
34 class BaseItem(BaseGameObject): | 34 class BaseItem(BaseGameObject): |
35 def __init__(self, gamecontroller, itemname, itemtype="unknown"): | 35 def __init__(self, gamecontroller, itemname, itemtype="unknown"): |
36 super(Item, self).__init__(gamecontroller, itemtype, itemname, True) | |
37 | |
38 self._type = GameObjectTypes["ITEM"] | 36 self._type = GameObjectTypes["ITEM"] |
37 super(BaseItem, self).__init__(gamecontroller, itemtype, itemname, True) | |
39 | 38 |
40 def onPickUp(self): | 39 def onPickUp(self): |
41 #remove item from the map | 40 #remove item from the map |
42 self.destroy() | 41 self.destroy() |
43 | 42 |
44 def onDrop(self, dropx, dropy): | 43 def onDrop(self, dropx, dropy): |
45 #recreate object | 44 #recreate object |
46 self._createFIFEInstance(self) | 45 self._createFIFEInstance(self, self._gamecontroller.scene.itemlayer) |
47 self.setMapPosition(dropx, dropy) | 46 self.setMapPosition(dropx, dropy) |
48 | 47 |
49 def _getItemType(self): | 48 def _getItemType(self): |
50 return self._name | 49 return self._name |
51 | 50 |