예제 #1
0
 def processAI(self):
     if self.leaveScreen:
         if self.speed > 5:
             self. speed -= .015
     elif self.speed <= 5:
         self.speed = 13
         aitools.goToTarget(self, self.target)
     else:
         self.speed -= 0.15
         self.velocity = self.velocity.makeNormal() * self.speed
예제 #2
0
    def processAI(self):
        if self.leaveScreen:
            pass
        elif self.active:
            """Find the distance to the player"""

            magnitude = self.target.position - self.position
            if magnitude.getMagnitude() < 250:
                """If the player is within x distance then
                charge the player."""
                self.speed = 7
            else:
                self.speed = 2

            aitools.goToTarget(self, self.target)
예제 #3
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)
예제 #4
0
    def processAI(self):
        if self.health <= self.world.level + 1:
            if self.charging:
                self.speed -= 0.2
                if self.speed <= 1.75:
                    self.speed = 1.75
                    self.charging = False
                    self.textGroup.add(self.eye)
                    self.timeUntilCharge = 7 * FRAMES_PER_SECOND
            else:
                if not self.timeUntilCharge:
                    self.charging = True
                    self.speed = 10
                    self.eye.kill()
                
                self.timeUntilCharge -= 1
                aitools.goToTarget(self,self.target)


        else:
            aitools.goToTarget(self, self.target)
예제 #5
0
    def processAI(self):
        self.charging = False
        """Find the distance to the player"""

        distance = (self.target.position - self.position).getMagnitude()

        if self.hideBehind.actorType == ACTOR_TYPE_BOSS:
            if distance < 450:
                self.speed = 10
                aitools.goToTarget(self, self.target)
                self.charging = True
                self.hiding = False

        else:
            if distance < 325:
                self.speed = 10
                aitools.goToTarget(self, self.target)
                self.charging = True
                self.hiding = False

        if not self.charging:
            self.speed = 7
            self.hiding = True
            aitools.hide(self, self.hideBehind, self.target)
예제 #6
0
    def processAI(self):
        if self.charging:
            self.speed -= 0.2

            if self.speed <= 2:
                self.speed = 2
                self.charging = False
                self.boundStyle = BOUND_STYLE_CUSTOM
                self.timeUntilCharge = 6 * FRAMES_PER_SECOND
            
            aitools.goToTarget(self,self.target)

        elif self.spinning:
            self.speed += 0.2
            
            if self.speed >= 40:
                self.speed = 15
                self.charging = True
                self.spinning = False
                self.timeUntilSpin = 7 * FRAMES_PER_SECOND
            
            self.velocity += self.velocity.getPerpendicular().makeNormal()
            self.velocity = self.velocity.makeNormal() * self.speed

        elif self.health <= (self.world.level + 1) * 7:
            if not self.timeUntilCharge:
                self.charge()
            elif not self.timeUntilSpin:
                self.spin()
            else:
                aitools.goToTarget(self,self.target)

        elif self.health <= (self.world.level + 1) * 14:
            if not self.timeUntilCharge:
                self.charge()
            else:
                aitools.goToTarget(self,self.target)

        else:
            aitools.goToTarget(self,self.target)
예제 #7
0
 def processAI(self):
     aitools.goToTarget(self, self.target)
예제 #8
0
    def charge(self):
        self.charging = True
        self.speed = 11

        aitools.goToTarget(self,self.target)
        self.boundStyle = BOUND_STYLE_REFLECT