summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpitfireX <timm.weber@me.com>2015-08-12 05:24:58 +0200
committerSpitfireX <timm.weber@me.com>2015-08-12 05:24:58 +0200
commit3650968ecf576fceae841f0ccd72cd8459b4aa01 (patch)
tree299940675c42e762e3056540c649a962688beb45
parentd0f7aa9e680df92e16a31c139bab76d4ee23b208 (diff)
Made gui surface update explicit + some angle stuff
-rw-r--r--gui.py2
-rw-r--r--interval_utils.py8
-rw-r--r--main.py1
-rw-r--r--strategy.py1
4 files changed, 8 insertions, 4 deletions
diff --git a/gui.py b/gui.py
index 55000da..688c095 100644
--- a/gui.py
+++ b/gui.py
@@ -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
diff --git a/main.py b/main.py
index 60fb8ad..d747869 100644
--- a/main.py
+++ b/main.py
@@ -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