Lights can now be turned on and off at night.
[tabakrolletjie.git] / tabakrolletjie / lights.py
index 54da531db68de8df8d3d7e9ca7333c10b4e2aa5f..ff7035abb0cfe09ceafa09ef344907b29114e5d5 100644 (file)
@@ -74,7 +74,12 @@ class LightManager(object):
         for light in self._lights:
             light.add(self._space)
 
-    def nearest(self, pos, surfpos=False, max_distance=1.0):
+    def toggle_nearest(self, *args, **kw):
+        light = self.nearest(*args, **kw)
+        if light:
+            light.toggle()
+
+    def nearest(self, pos, surfpos=True, max_distance=1.0):
         if surfpos:
             surface = pygame.display.get_surface()
             pos = pymunk.pygame_util.from_pygame(pos, surface)