Mercurial > fife-parpg
diff demos/shooter/scripts/scene.py @ 471:7a79dc2a0592
Adding the credits window (still needs to be written)
Hopefully fixed some memory leaks.
Moved the flashing code to the appropriate spot (in ShipBase).
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 15 Apr 2010 15:53:06 +0000 |
parents | 3b04e921c93d |
children | 10aff123c62c |
line wrap: on
line diff
--- a/demos/shooter/scripts/scene.py Wed Apr 14 19:15:27 2010 +0000 +++ b/demos/shooter/scripts/scene.py Thu Apr 15 15:53:06 2010 +0000 @@ -200,9 +200,9 @@ #TODO: search to ensure the object isn't already part of the scene loc = obj.instance.getLocation().getExactLayerCoordinates() nodeindex = int(loc.x * self._xscale) - + + obj.scenenodeid = nodeindex self._nodes[nodeindex].spaceobjects.append(obj) - obj.scenenodeid = nodeindex def addProjectileToScene(self, projectile): self._projectiles.append(projectile) @@ -212,10 +212,12 @@ nodeindex = int(loc.x * self._xscale) if nodeindex != obj.scenenodeid: - self._nodes[obj.scenenodeid].spaceobjects.remove(obj) + if obj in self._nodes[obj.scenenodeid].spaceobjects: + self._nodes[obj.scenenodeid].spaceobjects.remove(obj) + + obj.scenenodeid = nodeindex self._nodes[nodeindex].spaceobjects.append(obj) - obj.scenenodeid = nodeindex - + def removeObjectFromScene(self, obj): for node in self._nodes: if obj in node.spaceobjects: @@ -317,6 +319,7 @@ #remove any expired projectiles for p in projtodelete: if p in self._projectiles: + p.destroy() self._projectiles.remove(p)