def fire(self, target): """ Returns an AlienBullet with a trajectory towards the target's' current location. """ angle = math.atan2(target.center.y - self.center.y, target.center.x - self.center.x) angle = angle * 180 / math.pi #convert to degrees # put the origin point of the bullet far enough # away it does not photon itself. radius_adjust = self.texture.height / 2 * 1.25 laser_barrel_end = Point(radius_adjust * Velocity.cosine(angle), radius_adjust * Velocity.sine(angle)) laser_barrel_end = laser_barrel_end + self.center p = Point(laser_barrel_end.x, laser_barrel_end.y) v = Velocity(self.velocity.dx, self.velocity.dy) return AlienBullet(p, angle, v)