OBSTACLE_FILTER = pymunk.ShapeFilter(categories=OBSTACLE_CATEGORY)
+class ObstacleManager(object):
+ """ Manages a set of obstacles. """
+
+ def __init__(self, space, gamestate):
+ self._space = space
+ self._obstacles = [
+ BaseObstacle.load(cfg) for cfg in gamestate.station["obstacles"]]
+ for obs in self._obstacles:
+ obs.add(self._space)
+
+ def render(self, surface):
+ for obs in self._obstacles:
+ obs.render(surface)
+
+
class BaseObstacle(object):
def __init__(self):
self.body = pymunk.Body(0, 0, pymunk.body.Body.STATIC)