""" May it be a light for you in dark places, when all other lights go out.
"""
+import pymunk
+
class BaseLight(object):
""" Common light functionality. """
def __init__(self, colour, position):
+ self.body = pymunk.Body(0, 0, pymunk.body.Body.STATIC)
self.colour = colour
self.position = position
+ def add_to_space(self, space):
+ space.remove(self.body, **self.body.shapes())
+ shapes = self.determine_ray_polys(space)
+ space.add(self.body, **shapes)
+
+ def determine_ray_polys(self, space):
+ raise NotImplementedError(
+ "Lights should implement .determine_ray_polys.")
+
@classmethod
def load(cls, config):
kw = config.copy()