Hello,

I've been playing with Cocos' tile module a bit lately, and I think I found a 
bug in RectMapLayer.get_in_region. I'm using it with a manually created map 
(not using the xml map loader) for basic collision detection. Without this 
change, I would get more cells than I should and would hit walls 1 cell early 
on the bottom and left. AFAICT, it isn't affecting test_tiles.py one way or 
the other. Are there any other tests out there to verify this bug/fix?

-- 
-chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: cocos/tiles.py
===================================================================
--- cocos/tiles.py	(revision 864)
+++ cocos/tiles.py	(working copy)
@@ -794,8 +794,8 @@
         '''
         ox = self.origin_x
         oy = self.origin_y
-        x1 = max(0, (x1 - ox) // self.tw - 1)
-        y1 = max(0, (y1 - oy) // self.th - 1)
+        x1 = max(0, (x1 - ox) // self.tw)
+        y1 = max(0, (y1 - oy) // self.th)
         x2 = min(len(self.cells), (x2 - ox) // self.tw + 1)
         y2 = min(len(self.cells[0]), (y2 - oy) // self.th + 1)
         return [self.cells[i][j]

Reply via email to