Ejemplo n.º 1
0
 def actorUpdate(self):
     if self.collideStyle == COLLIDE_STYLE_NOVA:
         self.velocity += self.velocity.getPerpendicular().makeNormal() * 5
     
     if not self.lifeTimer % 3 and settingList[PARTICLES]:
         tempParticle = particle.starParticle()
         tempParticle.position = self.position.copy()
         
         self.effectsGroup.add(tempParticle)
     
     self.active = True
     self.lifeTimer -=  1
     
     if self.lifeTimer == 0:
         self.die()
Ejemplo n.º 2
0
 def bulletCollide(self, bullet):
     if not self.stunned:
         utility.playSound(self.bulletSound,BAAKE_CHANNEL)
         if bullet.collideStyle == COLLIDE_STYLE_HURT:
             bullet.die()
         
         elif bullet.collideStyle == COLLIDE_STYLE_REFLECT:
             if bullet.position.x < self.position.x - 64:
                 bullet.position = vector.vector2d(self.position.x - 112,bullet.position.y)
                 bullet.velocity *= [-1.0, 1.0]
             elif bullet.position.x > self.position.x + 64:
                 bullet.position = vector.vector2d(self.position.x + 112,bullet.position.y)
                 bullet.velocity *= [-1.0, 1.0]
             if bullet.position.y < self.position.y - 64:
                 bullet.position = vector.vector2d(bullet.position.x, self.position.y - 14)
                 bullet.velocity *= [1.0, -1.0]
             elif bullet.position.y > self.position.y + 64:
                 bullet.position = vector.vector2d(bullet.position.x, self.position.y + 140)
                 bullet.velocity *= [1.0, -1.0]
 
         elif bullet.collideStyle == COLLIDE_STYLE_NOVA:
             utility.playSound(self.shieldBreak, BAAKE_CHANNEL)
             self.stunned = 2 * FRAMES_PER_SECOND
             self.animationList.play("vulnerable")
             
             starsToCreate = 15
             
             while starsToCreate:
                 starsToCreate -= 1
                 tempBullet = particle.starParticle()
                 tempVector = vector.vector2d(120,0)
                 tempVector.setAngle(starsToCreate * 24)
                 tempBullet.position = vector.vector2d(self.position + tempVector)
                 tempBullet.lifeTimer = .5 * FRAMES_PER_SECOND
                 tempBullet.velocity = vector.vector2d(3.0, 0.0)
                 tempBullet.velocity.setAngle(starsToCreate * 24)
                 
                 
                 self.effectsGroup.add(tempBullet)
     
     elif bullet.collideStyle != COLLIDE_STYLE_NOVA:
             bullet.die()
             self.hurt(1)