##### # Template scene ##### import logging from Remake_1869 import Utils from pyglet.window import key from pyglet.window import mouse class TemplateScene: def __init__(self): print('Current Scene: Template\n') self.isAlive = True self.isInTransfer = False self.targetScene = None self.mouse_x = 0 self.mouse_y = 0 self.current_ScenePhase = 1 def close(self,game): #ensure everything must be closed or Fade-out is fadeout self.isInTransfer = True game.register_animation(game.d_active_sprites['blackscreen'],'FadeInSlow') self.setStopwatch(game.d_active_sprites['blackscreen'],5*60) def initializeSceneLogic(self,game): pass def on_mouse_motion(self, game, x, y, dx, dy): self.mouse_x = x self.mouse_y = y def on_mouse_press(self,game, x, y, button, modifiers): if button == 1: # Left click pass def on_key_press(self, game, symbol, modifiers): pass def prepareSprites(self, game, d_prites): pass def prepareLabels(self, game, d_labels): pass def prepareWidgets(self, game, d_widgets): pass def killWidgets(self, game ,d_widgets): pass def maintain_SpriteAnimations(self, l_deactivateAnims, sprite, animationType): if animationType is 'FadeIn': if Utils.fadeIn_sprite(sprite,sprite.opacity,5) is False: l_deactivateAnims.append(sprite) if animationType is 'FadeInSlow': if Utils.fadeIn_sprite(sprite,sprite.opacity,2) is False: l_deactivateAnims.append(sprite) if animationType is 'FadeOut': if Utils.fadeOut_sprite(sprite,sprite.opacity,5) is False: l_deactivateAnims.append(sprite) def maintain_LabelAnimations(self, l_deactivateAnims, label, animationType): if animationType is 'ToggleAlpha': Utils.toggle_label(label, label.color) l_deactivateAnims.append(label) if animationType is 'FadeIn': if Utils.fadeIn_label(label,label.color,5) is False: l_deactivateAnims.append(label) def doSceneLogic(self, game): pass def run(self, game): game.stopwatch_tick() self.doSceneLogic(game) if self.isInTransfer is True: if game.checkStopwatch(game.d_active_sprites['blackscreen'],0): self.isAlive = False self.targetScene = 'NEXTSCENE' return self.targetScene