# HG changeset patch # User prock@33b003aa-7bff-0310-803a-e67f0ece8222 # Date 1271074887 0 # Node ID f87f686b5b5928ee83c507423522785f8e6474e6 # Parent 5e1d6e40d19d81383bb01766159a1057c240b9e4 Projectiles from enemy ships no longer destroy other enemies. diff -r 5e1d6e40d19d -r f87f686b5b59 demos/shooter/scripts/scene.py --- a/demos/shooter/scripts/scene.py Fri Apr 09 21:42:28 2010 +0000 +++ b/demos/shooter/scripts/scene.py Mon Apr 12 12:21:27 2010 +0000 @@ -240,7 +240,7 @@ self.playerHit() obj.destroy() -# self._world.renderBoundingBox(obj) + self._world.renderBoundingBox(obj) @@ -253,20 +253,20 @@ #cant get hit by your own bullet if p.owner != o: if p.boundingbox.intersects(o.boundingbox): - if o != self._player: + if o != self._player and p.owner.isplayer: self._player.applyScore(100) p.destroy() o.destroy() #TODO: the destroy functions should spawn an explosion #and also destroy the instance and remove itself from the scene #self.removeObjectFromScene(o) - else: + elif o == self._player: #player got hit by a projectile if not self._player.invulnerable: p.destroy() self.playerHit() -# self._world.renderBoundingBox(p) + self._world.renderBoundingBox(p) #build a list of projectiles to remove (ttl expired) diff -r 5e1d6e40d19d -r f87f686b5b59 demos/shooter/scripts/ships/player.py --- a/demos/shooter/scripts/ships/player.py Fri Apr 09 21:42:28 2010 +0000 +++ b/demos/shooter/scripts/ships/player.py Mon Apr 12 12:21:27 2010 +0000 @@ -42,6 +42,8 @@ self._lives = 3 self._invulnerable = False + + self._isplayer = True def init(self): self._lives = 3 diff -r 5e1d6e40d19d -r f87f686b5b59 demos/shooter/scripts/ships/shipbase.py --- a/demos/shooter/scripts/ships/shipbase.py Fri Apr 09 21:42:28 2010 +0000 +++ b/demos/shooter/scripts/ships/shipbase.py Mon Apr 12 12:21:27 2010 +0000 @@ -40,6 +40,8 @@ #1 = on, 0 = invisible (off) self._flashstate = 1 + + self._isplayer = False def _setWeapon(self, weapon): self._weapon = weapon @@ -85,6 +87,10 @@ self._flashnumber -= 1 super(Ship, self).update() + + def _isPlayer(self): + return self._isplayer + isplayer = property(_isPlayer) weapon = property(_getWeapon, _setWeapon) \ No newline at end of file