Example #1
0
 def processAI(self):
     if self.leaveScreen:
         pass
     else:
         self.target = aitools.getClosest(self, self.powerupGroup)
 
         if self.target != self and self.target.active:
             aitools.goToTarget(self, self.target)
             self.changeDirection = 0
 
         else:
             if not self.changeDirection:
                 self.targetPoint = vector.vector2d((random.random() * (SCREEN_WIDTH + 200)) - 100, (random.random() * (SCREEN_HEIGHT + 200)) - 100)
                 self.changeDirection = 30
             self.changeDirection -= 1
             
             aitools.arcToPoint(self, self.targetPoint)
Example #2
0
    def actorUpdate(self):
        self.emitter.update()
        
        if self.active and self.health <= 0:
            self.health = 0
            self.active = False
            self.die()
        else:
            """This can occasionally cause an error
            if the rokubi has been removed from the
            group by an outside function, such as when
            moving on to a new level."""
            if (not self.bossFight or not self.active and not self.charging) and not self.hiding:
                try:
                    self.hideBehind = aitools.getClosest(self, [self.enemyGroup,self.bossGroup], [ACTOR_TYPE_BAAKE, ACTOR_TYPE_BOSS])
                    if self.hideBehind == self:
                        self.hideBehind = self.target
                except:
                    self.hideBehind = self.target

            self.active = True
            
        self.processAI()