def __init__(self):
     # Load the flashlight images
     self.__loadimages()
     # Set the first direction to the first in the DIRS array (see src.constants)
     self.currentdir = DIRS[0]
     # Set the surface for this direction
     self.updateSurf()
     # Complete the initialization of an "ordinary overlay"
     Overlay.__init__(self, "_flashlight", self.surf)
 def render(self, screen, active=True):
     # If this overlay is active and the global property
     # for flashlight movement is enabled, determine a new
     # direction for the flashlight if necessary.
     if active and get_property(FLASHLIGHT_MOVEMENT_ENABLED):
         # Determine direction
         mpos = pygame.mouse.get_pos()
         newdir = get_direction_from_point_to_point(SCREEN_CENTER, mpos)
         # If this is a new direction, change it and the Surface
         if newdir is not self.currentdir:
             self.currentdir = newdir
             self.updateSurf()
     # Render
     Overlay.render(self, screen)
 def __init__(self, color, duration, flags, visible=True, start_opacity=255, stop_opacity=0):
     # Set attributes and create the surface
     self.surf = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT))
     self.surf.fill(color)
     self.surf.set_alpha(start_opacity)
     self.start_opacity = start_opacity
     self.stop_opacity = stop_opacity
     self.color = color
     self.dur = duration
     # Setup start time (for animation)
     self.starttime = time.time()
     self.visible = visible
     self.animationfinished = False
     self.name = "_animatedcolor"
     self.flags = flags
     # Complete initialization process
     Overlay.__init__(self, self.name, self.surf, self.visible, self.flags)