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 __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)