diff options
-rw-r--r-- | gui.py | 2 | ||||
-rw-r--r-- | interval_utils.py | 8 | ||||
-rw-r--r-- | main.py | 1 | ||||
-rw-r--r-- | strategy.py | 1 |
4 files changed, 8 insertions, 4 deletions
@@ -269,5 +269,3 @@ def draw_frame(): c.send_shoot() if event.type == MOUSEMOTION: c.send_target(*win_to_world_pt(event.pos, c.player.center)) - - pygame.display.update() diff --git a/interval_utils.py b/interval_utils.py index 4c3f8e2..e95445a 100644 --- a/interval_utils.py +++ b/interval_utils.py @@ -45,4 +45,10 @@ def find_largest_angle_interval(intervals): intervals_ = intervals return max(intervals_, key=lambda p:p[1]-p[0]) - + +def get_point_angle(origin, p): + dx = p[0] - origin[0] + dy = p[1] - origin[1] + rads = atan2(-dy,dx) + rads %= 2*pi + return rads @@ -53,3 +53,4 @@ while True: stats.log_pos(c.player.center) stats.log_mass(c.player.total_mass) + gui.update()
\ No newline at end of file diff --git a/strategy.py b/strategy.py index 92e0ad2..1f1995f 100644 --- a/strategy.py +++ b/strategy.py @@ -98,6 +98,5 @@ class Strategy: # more debugging gui.draw_line(c.player.center, self.target, self.color) - gui.update() return self.target |