from gamedata.objects.base import BaseObject class Transition(BaseObject): def __init__(self,game,time=0.7,holdtime=0,level=None,endcinematic=False): super().__init__(0,0,game) self.color = [31,14,28] self.surface = game.pygame.Surface((game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT)) self.surface.fill(self.color) self.level = level self.endcinematic = endcinematic self.timer = game.lib.Timer(time) self.holdtimer = game.lib.Timer(holdtime) self.hold = False self.alpha = 0 self.ispaused = False self.depth = 4 def step(self): if not self.hold: self.alpha = (1-self.timer.getratio())*255 if self.timer.tick(self.game.dt): self.hold = True self.alpha = 255 else: if self.holdtimer.tick(self.game.dt): if not self.endcinematic: if self.level: self.game.globals["overworld"] = False self.game.scenes.ingame(self.game,level = self.level) else: self.game.globals["overworld"] = True self.game.scenes.overworld(self.game) else: self.game.scenes.end(self.game) self.game.globals["pause"] = False def draw(self): self.surface.set_alpha(self.alpha) self.game.window.blit(self.surface,[0,0])