X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=tabakrolletjie%2Flights.py;h=ff7035abb0cfe09ceafa09ef344907b29114e5d5;hb=758bdeeae4acd227637b9bc269b159ba470babbd;hp=54da531db68de8df8d3d7e9ca7333c10b4e2aa5f;hpb=897df74f77377ed8c78a67db1ad6cd14274ade48;p=tabakrolletjie.git diff --git a/tabakrolletjie/lights.py b/tabakrolletjie/lights.py index 54da531..ff7035a 100644 --- a/tabakrolletjie/lights.py +++ b/tabakrolletjie/lights.py @@ -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)