Example #1
0
 def processAI(self):
     if not self.changeDirection:
         self.changeDirection = 2 * FRAMES_PER_SECOND
         
         aitools.cardinalDirection(self)
             
     self.changeDirection -= 1
Example #2
0
    def processAI(self):
        if not self.changeDirection:
            self.changeDirection = 2 * FRAMES_PER_SECOND
            self.moving = 12
            arcDirection = int(random.random() * 2) - 1

            if arcDirection:
                self.arc = 0.7
            else:
                self.arc = -0.7

            aitools.cardinalDirection(self)

        if self.moving:
            self.speed = 5
            self.moving -= 1
        else:
            self.speed = 7
            self.velocity += self.velocity.getPerpendicular().makeNormal() * self.arc
            self.velocity = self.velocity.makeNormal() * self.speed
                    
            self.changeDirection -= 1