Skip to content

Instantly share code, notes, and snippets.

@PatrickKalkman
Created June 13, 2021 11:57
Show Gist options
  • Save PatrickKalkman/bb0dcb54f7fd82d060b3a32ec646be29 to your computer and use it in GitHub Desktop.
Save PatrickKalkman/bb0dcb54f7fd82d060b3a32ec646be29 to your computer and use it in GitHub Desktop.
Calculcate the rotation of the enemy space ship
def calculate_rotation(self, previous_point, current_point):
dx = current_point.xpos - previous_point.xpos
dy = current_point.ypos - previous_point.ypos
return math.degrees(math.atan2(dx, dy)) + 180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment