From 0a23008116995aab2c113b6540a528b43027abed Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Fri, 31 Jan 2014 02:14:51 +0000 Subject: add sharing to polygons and magic pen --- (limited to 'helpers.py') 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 + -- cgit v0.9.1