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 thrustToTargetRadius(self):
    if abs(vectorDirection(self.target.vector())) < 0.5:
       distance = vectorMagnitude(self.target.vector()) - (Misc.WEAPON_RANGE / 2.0)
       speed = vectorScalarProjection(self.target.velocity(), [-1, 0])
       
       maxTowardAcceleration = self.analysis.maxRemainingForwardAcceleration()
       maxAwayAcceleration = self.analysis.maxRemainingReverseAcceleration()
       
       power = Autolib.powerForSmoothApproach(distance, speed, 
                                         maxTowardAcceleration, 
                                         maxAwayAcceleration)
 
       self.powerEngines(power, self.analysis.forwardEngines, self.analysis.reverseEngines)
       self.currentStatus = (0.5, "approaching")