Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/helpers.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.py')
-rw-r--r--helpers.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/helpers.py b/helpers.py
index 65b07cd..2f4b6f1 100644
--- a/helpers.py
+++ b/helpers.py
@@ -163,3 +163,12 @@ def tuple_to_int(tuple_input):
"""Cast tuple values to ints to avoid gtk+ and pygame's dislike of floats.
"""
return [int(i) for i in tuple_input]
+
+
+def find_body(world, pos):
+ body = world.get_bodies_at_pos(tuple_to_int(pos))
+ if isinstance(body, list) and len(body) > 0:
+ return body[0]
+ else:
+ return None
+