Ejemplo n.º 1
0
 def rotateToFaceTarget(self):
    angularDistance = vectorDirection(Autolib.interceptVector(self.target))
    angularSpeed = self.ship.spin()
    
    power = Autolib.powerForSmoothApproach(angularDistance, angularSpeed,
                                      self.analysis.maxPositiveDizzy, 
                                        self.analysis.maxNegativeDizzy)
       
    self.powerEngines(power, self.analysis.positiveDizzyEngines, self.analysis.negativeDizzyEngines)
    self.currentStatus = (0.2, "acquiring target")
Ejemplo n.º 2
0
   def fireIfAble(self):
      spinSpeed = abs(self.ship.spin() * 0.51)

      for target in self.targets:
         vector = Autolib.interceptVector(target)

         direction = abs(vectorDirection(vector))

         if direction < spinSpeed:
            self.fireAtTarget()
            return
Ejemplo n.º 3
0
   def fireWeaponsIfPossible(self):
      intercept = Autolib.interceptVector(self.target)
      direction = abs(vectorDirection(intercept))
      range = abs(vectorMagnitude(intercept))
      
      if direction < 0.1 and range < Misc.WEAPON_RANGE:
         self.weaponsEngaged = True

      if direction > 0.3 or range > Misc.WEAPON_RANGE * 2.5:
         self.weaponsEngaged = False
         
      if self.weaponsEngaged:
         self.currentStatus = (1.0, "firing")
         self.fireAllWeapons()