From: Neil Date: Sat, 10 Sep 2016 21:55:12 +0000 (+0200) Subject: Fix ordering of rays X-Git-Tag: tabakrolletjie-v1.0.0~26^2~1 X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=commitdiff_plain;h=a0ba20f754146e02508bc40503eb9c093f0db3ad Fix ordering of rays --- diff --git a/tabakrolletjie/rays.py b/tabakrolletjie/rays.py index 7d880d0..ac51802 100644 --- a/tabakrolletjie/rays.py +++ b/tabakrolletjie/rays.py @@ -18,13 +18,13 @@ def screen_rays(pos, bounding_radius): """ r = int(bounding_radius) left, right = int(pos.x) - r, int(pos.x) + r - bottom, top = int(pos.y) + r, int(pos.y) - r + bottom, top = int(pos.y) - r, int(pos.y) + r step = 1 - for y in range(top, bottom + 1, step): + for y in range(bottom, top + 1, step): yield pymunk.Vec2d(left, y) for x in range(left, right + 1, step): yield pymunk.Vec2d(x, top) - for y in range(bottom, top - 1, -step): + for y in range(top, bottom - 1, -step): yield pymunk.Vec2d(right, y) for x in range(right, left - 1, -step): yield pymunk.Vec2d(x, bottom)