示例#1
0
 def fire_laser(self):
     laser = Laser(self.batch, self.objects)
     laser.x = self.x + self.sprite.width // 2 * math.cos(self.rotation)
     laser.y = self.y + self.sprite.height // 2 * math.sin(self.rotation)
     laser.x_speed = self.x_speed + LASER_SPEED * math.cos(self.rotation)
     laser.y_speed = self.y_speed + LASER_SPEED * math.sin(self.rotation)
     laser.rotation = self.rotation
示例#2
0
 def fire_laser(self):
     if (self.laser_cooldown <= 0):
         laser = Laser(self.batch, self.objects)
         laser.x = self.x + self.sprite.width // 2 * math.cos(self.rotation)
         laser.y = self.y + self.sprite.height // 2 * math.sin(
             self.rotation)
         laser.x_speed = self.x_speed + LASER_SPEED * math.cos(
             self.rotation)
         laser.y_speed = self.y_speed + LASER_SPEED * math.sin(
             self.rotation)
         laser.rotation = self.rotation
         self.laser_cooldown = LASER_FIRE_RATE