Mercurial > fife-parpg
diff demos/rpg/scripts/objects/baseobject.py @ 530:ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
Cleaned up the base object a bit so you can modify it's position easily.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 28 May 2010 20:10:33 +0000 |
parents | d0bce896a526 |
children | 2e739ae9a8bc |
line wrap: on
line diff
--- a/demos/rpg/scripts/objects/baseobject.py Fri May 28 16:25:00 2010 +0000 +++ b/demos/rpg/scripts/objects/baseobject.py Fri May 28 20:10:33 2010 +0000 @@ -70,6 +70,7 @@ self._id = self._name self._instance = None + self._position = fife.DoublePoint(0.0, 0.0) if not hasattr(self, "_type"): self._type = GameObjectTypes["DEFAULT"] @@ -85,6 +86,8 @@ self._instance = self._gamecontroller.scene.actorlayer.getInstance(self._id) self._instance.thisown = 0 + self._activated = True + def destroy(self): """ @@ -102,11 +105,11 @@ def setMapPosition(self, x, y): curloc = self.location - exactloc = self.location.getExactLayerCoordinates() - exactloc.x = x - exactloc.y = y + self._position = self.location.getExactLayerCoordinates() + self._position.x = x + self._position.y = y - curloc.setExactLayerCoordinates(exactloc) + curloc.setExactLayerCoordinates(self._position) self.location = curloc def _createFIFEInstance(self, layer): @@ -118,8 +121,11 @@ self._instance = layer.createInstance(self._fifeobject, fife.ModelCoordinate(0,0), self._id) fife.InstanceVisual.create(self._instance) + self._instance.thisown = 0 - + + self.setMapPosition(self._position.x,self._position.y) + def _getLocation(self): return self._instance.getLocation() @@ -137,9 +143,25 @@ def _getModelName(self): return self._name - + + def _getPosition(self): + self._position = self.location.getExactLayerCoordinates() + return (self._position.x, self._position.y) + + def _setPosition(self, tuplexy): + self.setMapPosition(tuplexy[0],tuplexy[1]) + + def _getActivated(self): + return self._activated + + def _setActivated(self, activate): + self._activated = activate + + location = property(_getLocation, _setLocation) instance = property(_getInstance) type = property(_getType) id = property(_getId) modelname = property(_getModelName) + position = property(_getPosition, _setPosition) + activated = property(_getActivated, _setActivated)