projects
/
tabakrolletjie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0210328
)
Add filter to obstacle shapes.
author
Simon Cross
<hodgestar@gmail.com>
Sun, 4 Sep 2016 20:39:29 +0000
(22:39 +0200)
committer
Simon Cross
<hodgestar@gmail.com>
Sun, 4 Sep 2016 20:39:29 +0000
(22:39 +0200)
tabakrolletjie/obstacles.py
patch
|
blob
|
history
diff --git
a/tabakrolletjie/obstacles.py
b/tabakrolletjie/obstacles.py
index d187a599294de659c54a70a3e08a27ba5692230f..32df5b4561d6672c3931d5a436eb7e914c3f6dfc 100644
(file)
--- a/
tabakrolletjie/obstacles.py
+++ b/
tabakrolletjie/obstacles.py
@@
-4,6
+4,10
@@
import pymunk
import pymunk.pygame_util
import pygame.draw
+from .constants import OBSTACLE_CATEGORY
+
+OBSTACLE_FILTER = pymunk.ShapeFilter(categories=OBSTACLE_CATEGORY)
+
class BaseObstacle(object):
def __init__(self):
@@
-13,6
+17,8
@@
class BaseObstacle(object):
def add(self, space):
if self.body.space is not None:
space.remove(self.body, *self.body.shapes)
+ for shape in self.shapes:
+ shape.filter = OBSTACLE_FILTER
space.add(self.body, *self.shapes)
def render(self, surface):