diff options
author | Walter Bender <walter@sugarlabs.org> | 2014-01-31 02:14:51 (GMT) |
---|---|---|
committer | Walter Bender <walter@sugarlabs.org> | 2014-01-31 02:14:51 (GMT) |
commit | 0a23008116995aab2c113b6540a528b43027abed (patch) | |
tree | 799e513f19d3b9758f3fbb67d007550bbeaf6e73 /helpers.py | |
parent | 44a008996d1683ed09c165d56c760587e2930316 (diff) |
add sharing to polygons and magic pen
Diffstat (limited to 'helpers.py')
-rw-r--r-- | helpers.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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 + |