You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rockets launched by the player can detect only the one - closest to the player - hostile ship from game.hostiles SpriteList. If 2 or more rockets are launched, each would target the same enemy, if it is still the closest hostile, since there is no method of excluding targetted Sprites from being targetted.
This is how rockets targetting algorithm looks like:
def rocket_autoaim(self):
"""
Method used only by 'rockets'. They make turns towards enemies.
"""
# acquire target if has any and there are possible targets
if not self.target and len(game.hostiles) > 0:
if self.angle == UPWARD: # if rocket fired by player
# TODO: rockets ignoring targets already acquired by other
# rockets and take next one [ ][ ], test it [ ]
# closest enemy ship:
self.target = arcade.get_closest_sprite(self, game.hostiles)[0]
else:
self.target = game.player
The problem is, that method get_closest_sprite() of arcade.SpriteList accepts only the SpriteList, and not the list as the second argument. Creating another SpriteList for that purpose would be an
overkill.
The text was updated successfully, but these errors were encountered:
Rockets launched by the player can detect only the one - closest to the player - hostile ship from game.hostiles SpriteList. If 2 or more rockets are launched, each would target the same enemy, if it is still the closest hostile, since there is no method of excluding targetted Sprites from being targetted.
This is how rockets targetting algorithm looks like:
The problem is, that method get_closest_sprite() of arcade.SpriteList accepts only the SpriteList, and not the list as the second argument. Creating another SpriteList for that purpose would be an
overkill.
The text was updated successfully, but these errors were encountered: