def note(storage, obj, m):
    storage._go()
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        tr.deleteAll()
        
        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Text of the note
        y = 140
        ofs = 18
        tr.write("Who would have done something like this?!",\
                 0, COLOR_TEXT, (100, y + (ofs*0)))
        tr.write("My little girl... you shouldn't have had to suffer through this.",\
                 0, COLOR_TEXT, (100, y + (ofs*1)))
        tr.write("After I found your lifeless body, I took it to your most favourite place.",\
                 0, COLOR_TEXT, (100, y + (ofs*2)))
        tr.write("Surely you will find peace among there.",\
                 0, COLOR_TEXT, (100, y + (ofs*3)))
        tr.write("I looked at your picture today.",\
                 0, COLOR_TEXT, (100, y + (ofs*5)))
        tr.write("I do not know if it is just me, but your mother's expression changed.",\
                 0, COLOR_TEXT, (100, y + (ofs*6)))
        tr.write("There she sits, to your right, and what appears to be a sole tear runs down her cheek.",\
                 0, COLOR_TEXT, (100, y + (ofs*7)))
        tr.write("Can a painting feel emotions?",\
                 0, COLOR_TEXT, (100, y + (ofs*9)))
        tr.write("Now I am surely being silly.",\
                 0, COLOR_TEXT, (100, y + (ofs*10)))
        tr.write("I will miss you, big sister.",\
                 0, COLOR_TEXT, (100, y + (ofs*11)))
        tr.write("- J",\
                 0, COLOR_TEXT, (100, y + (ofs*13)))
        
        # Wait for user input
        storage._pauseUntilClick()
        
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)        
        # Delete texts
        tr.deleteAll()
        
        storage._toggleCutscene(False)
    storage._halt()
def note(storage, obj, m):
    storage._go()
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        _lastitem[0] = "note"
        _lastitem[1] += 1
        storage._toggleCutscene(True)
        ad = GlobalServices.getAudioDevice()
        # Overlays
        note = OverlayFactory.create("note_big.png")
        text = OverlayFactory.create("lastnote.png")
        m.addOverlay(note)
        m.addOverlay(text)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Wait for user input
        storage._pauseUntilClick()
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(text)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND) 
        storage._toggleCutscene(False)
        set_property(SAVE_ENABLED, False)
        storage._setData('attic_noteseen', True)
    storage._halt()
    checkEnding(storage, m)
def init(storage, m):
    storage._go()
    storage._toggleCutscene(True)
    ad = GlobalServices.getAudioDevice()
    tr = GlobalServices.getTextRenderer()
    ad.stop(MUSIC, 5000)
    ad.stop(SOUND, 5000, 'amb_guardian')
    # Make the overlay
    darktrans = OverlayFactory.create_animated_color((20,0,0),\
                5000, 0, True, 0, 220)
    dark = OverlayFactory.create_by_color((20,0,0), 0, 220)
    fog = OverlayFactory.create("fog.png", pygame.BLEND_MULT)
    white = OverlayFactory.create("noise.png", pygame.BLEND_MULT)
    m.clearOverlays()
    m.addOverlay(darktrans)
    m.addOverlay(fog)
    
    player = m.getPlayer()
    shadow = m.getShadow()
    shadow.setPosition(conv_tile_pixel((8,10),m))
    
    player.setDirection([0,-1])
    player.halfSpeed()
    
    
    # Here be dragons
    storage._wait(5000)
    m.rendering_enabled = True
    m.addOverlay(dark)
    m.removeOverlay(darktrans)
    ad.play(MUSIC, 'bgm_4', VOLUME_MUSIC, -1)
    ad.play(SOUND, 'flashlight_toggle', VOLUME_SOUND)
    
    storage._wait(2000)
    tr.write("What is this place?", 3)
    storage._wait(3000)
    tr.write("It feels... strangely familiar.", 3)
    storage._wait(2000)
    ad.play(SOUND, 'noise', VOLUME_SOUND_AMBIENT + 0.3, -1)
    m.addOverlay(white)
    shadow.setVisible(True)
    storage._wait(300)
    m.removeOverlay(white)
    ad.stop(SOUND, 0, 'noise')
    shadow.setVisible(False)
    shadow.setPosition(conv_tile_pixel((8,12),m))
    storage._wait(1500)
    m.addOverlay(white)
    ad.play(SOUND, 'noise', VOLUME_SOUND_AMBIENT + 0.3, -1)
    shadow.setVisible(True)
    shadow.moveBy((0, 15), 500)
    storage._wait(450)
    m.removeOverlay(white)
    ad.stop(SOUND, 0, 'noise')
    shadow.setVisible(False)
    
    storage._toggleCutscene(False)
    set_property(SAVE_ENABLED, False)
    storage._halt()
def officenote(storage, obj, m):
    storage._go()
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        tr.deleteAll()
        
        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Text of the note
        y = 150
        ofs = 18
        tr.write("The doctor's said that everything is going to be fine.",\
                 0, COLOR_TEXT, (100, y + (ofs*0)))
        tr.write("I won't give my offspring away only because your senile self",\
                 0, COLOR_TEXT, (100, y + (ofs*1)))
        tr.write("blames everything on him! How dare you speak those insults!",\
                 0, COLOR_TEXT, (100, y + (ofs*2)))
        tr.write("Cly has NOTHING to do with any of the disappearances of our family.",\
                 0, COLOR_TEXT, (100, y + (ofs*3)))
        tr.write("I mean, God, why do you keep saying that?! Haven't you heard",\
                 0, COLOR_TEXT, (100, y + (ofs*4)))
        tr.write("the inspector's words? He's innocent!",\
                 0, COLOR_TEXT, (100, y + (ofs*5)))
        tr.write("I took your key to where you wrongfully locked my son, you monster.",\
                 0, COLOR_TEXT, (100, y + (ofs*7)))
        tr.write("This will be hard to forgive, father.",\
                 0, COLOR_TEXT, (100, y + (ofs*8)))
        tr.write("- M",\
                 0, COLOR_TEXT, (100, y + (ofs*10)))
        
        # Wait for user input
        storage._pauseUntilClick()
        
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)        
        # Delete texts
        tr.deleteAll()
        storage._toggleCutscene(False)
    storage._halt()
def hintnote(storage, obj, m):
    storage._go()
    
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        tr.deleteAll()
        
        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Text of the note
        y = 200
        ofs = 18
        tr.write("Claire:",\
                 0, COLOR_TEXT, (100, y + (ofs*0)))
        tr.write("You know that I had to seal the master's bedroom for a reason, right?",\
                 0, COLOR_TEXT, (100, y + (ofs*2)))
        tr.write("It is not at all because of personal disapproval or anything like that.",\
                 0, COLOR_TEXT, (100, y + (ofs*3)))
        tr.write("Please understand that it is for our own good, and safety.",\
                 0, COLOR_TEXT, (100, y + (ofs*4)))
        tr.write("Please do not try to unlock it. Trust me on this one.",\
                 0, COLOR_TEXT, (100, y + (ofs*5)))
        tr.write("- J",\
                 0, COLOR_TEXT, (100, y + (ofs*7)))
        
        # Wait for user input
        storage._pauseUntilClick()
        
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)        
        # Delete texts
        tr.deleteAll()
        
        storage._toggleCutscene(False)
        
    storage._halt()
def relaxnote(storage, obj, m):
    storage._go()
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        tr.deleteAll()
        
        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Text of the note
        y = 150
        ofs = 18
        tr.write("This boy is getting out of hand!",\
                 0, COLOR_TEXT, (100, y + (ofs*0)))
        tr.write("He seems to be less and less certifiably sane, to put it in fancy terms.",\
                 0, COLOR_TEXT, (100, y + (ofs*2)))
        tr.write("I have locked him in his room after what he did to aunt Sophie.",\
                 0, COLOR_TEXT, (100, y + (ofs*3)))
        tr.write("This has nothing to do with bad manners anymore, Marnie!",\
                 0, COLOR_TEXT, (100, y + (ofs*4)))
        tr.write("The child is vile and struck by evil, I tell you. Why won't you listen to me, Marnie?",\
                 0, COLOR_TEXT, (100, y + (ofs*5)))
        tr.write("This, this is not your child anymore. Please be reasonable and get help.",\
                 0, COLOR_TEXT, (100, y + (ofs*6)))
        tr.write("- Harold",\
                 0, COLOR_TEXT, (100, y + (ofs*8)))
        
        # Wait for user input
        storage._pauseUntilClick()
        
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)        
        # Delete texts
        tr.deleteAll()
        storage._toggleCutscene(False)
    storage._halt()
 def teleport(self, source, obj, target, destination):
     self._go()
     
     if self._playerInDistance(source.getPlayer().position, obj.rect):
         # Play the sound of this TeleportClickable object
         # (if there is one; could be a door squeaking etc)
         if hasattr(obj, 'sound'):
             GlobalServices.getAudioDevice().play(SOUND, obj.sound, 0.8)
         
         self.teleport_in_progress = True
         set_property(PLAYER_MOVEMENT_ENABLED, False)
         
         # Save the state of the current map's properties to the persistent shelf
         # before teleporting to the new map
         update_persistent_map_properties(source, get_savegame())
         
         dur = 1000
         fadeout = OverlayFactory.create_animated_color((0,0,0), dur, 0, True, 0, 255)
         source.addOverlay(fadeout)
         self._wait(dur)
         source.rendering_enabled = False
         GlobalServices.getEventManager().post(MapChangeRequestEvent((target, destination)))
         
         source.removeOverlay(fadeout)
         source.flushOverlayQueue()
         set_property(PLAYER_MOVEMENT_ENABLED, True)
         self.teleport_in_progress = False
         
     self._halt()
def checkEnding(storage, m):
    storage._go()
    ad = GlobalServices.getAudioDevice()
    ad.stop(SOUND, 0, 'insanity_ear_ring')
    ad.play(SOUND, 'insanity_ear_ring', (0.02*_lastitem[1]), -1, 0)
    # Check if the ending has been reached
    if  storage._getData('attic_photoseen')\
    and storage._getData('attic_handseen')\
    and storage._getData('attic_noteseen')\
    and storage._getData('attic_gunseen')\
    and storage._getData('attic_pencilseen'):
        storage._halt()
        ending(storage, m)
    else:
        # Add a random scare if necessary
        if _lastitem[1] % 2 == 0:
            white = OverlayFactory.create("noise.png", pygame.BLEND_MULT)
            storage._wait(1000)
            shadow = m.getShadow()
            shadow.setPosition(conv_tile_pixel((random.randrange(3,12),\
                                                random.randrange(7,11)),m))
            m.addOverlay(white)
            shadow.setVisible(True)
            ad.play(SOUND, 'noise', VOLUME_SOUND + 0.1, -1)
            storage._wait(300)
            m.removeOverlay(white)
            ad.stop(SOUND, 0, 'noise')
            shadow.setVisible(False)
        storage._halt()
def dronesound(storage, obj, m):
    storage._go()
    if storage._getData('rightwing_powershortage'):
        remove_from_map(storage.s, SCRIPT, m.properties['key_name'], 'dronesound')
        ad = GlobalServices.getAudioDevice()
        
        ad.play(SOUND, 'drone', VOLUME_SOUND_AMBIENT, 0, 1500)
        black = OverlayFactory.create_by_color((0,0,0), 0, 255)
        
        storage._wait(3000)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        storage._wait(50)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(100)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(50)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark2', VOLUME_SOUND)
        storage._wait(1750)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(100)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
    storage._halt()
 def __init__(self):
     ViewInterface.__init__(self)
     # Renderer object that displays the map
     self.renderer = tiledtmxloader.helperspygame.RendererPygame()
     self.renderer.set_camera_position_and_size(200, 300, SCREEN_WIDTH, SCREEN_HEIGHT)
     # Reference to current map to be rendered (will be updated whenever the Game object posts a MapChangeEvent)
     self.currentmap = None
     # Reference to currently highlighted object (will be set by the view controller whenever that actually happens)
     self.highlighted = None
     # Reference to currently highlighted inventory item (only relevant when it's actually open)
     self.invitem = None
     # Boolean switch that depicts if the inventory is open or not
     self.inventory_open = False
     # Boolean switch that depicts if the game menu is open or not
     self.gamemenu_open = False
     self.darkened = OverlayFactory.create_by_color((0,0,0), 0, 200)
     self.backtogame = [GlobalServices.getTextRenderer().writeAsSurface(\
                       "Back to Game", COLOR_TEXT, FONTSTYLE_CAPTION),\
                        (100,300)]
     self.backtomainmenu = [GlobalServices.getTextRenderer().writeAsSurface(\
                           "Back to Main menu", COLOR_TEXT, FONTSTYLE_CAPTION),\
                            (100,328)]
     self.selected = None
     # Screen handle, used for screenshot saving
     self.screen_surface = None
def scare(storage, obj, m):
    storage._go()
    player = m.getPlayer()
    shadow = m.getShadow()
    ad = GlobalServices.getAudioDevice()
    fl = m.getOverlay("_flashlight")
    player.stopMoving()
    storage._toggleCutscene(True)
    # Helper function for looking in a direction
    def face(direction):
        fl.point(direction)
        player.setDirection(string_to_direction(direction))
        
    face("left")
    
    fog = OverlayFactory.create("fog.png", pygame.BLEND_MULT)
    black = OverlayFactory.create_by_color((0,0,0), 0, 255)
    red = OverlayFactory.create_by_color((200,0,0), 0, 40)
    m.addOverlay(fog)
    m.addOverlay(red)
    # Show shadow
    shadow.setPosition(conv_tile_pixel((31,17), m))
    ad.play(SOUND, '27_orb_implode', VOLUME_SOUND + 0.1)
    ad.play(SOUND, 'scare_male_terrified5', VOLUME_SOUND)
    shadow.setVisible(True)
    storage._wait(1100)
    shadow.moveBy((-70,0), 3000)
    storage._wait(1900)
    ad.play(SOUND, 'insanity_whisper03', VOLUME_SOUND)
    m.addOverlay(black)
    ad.play(SOUND, '27_spark2', VOLUME_SOUND)
    storage._wait(300)
    m.removeOverlay(fog)
    m.removeOverlay(red)
    shadow.setVisible(False)
    m.removeOverlay(black)
    ad.play(SOUND, '27_spark4', VOLUME_SOUND)
    storage._wait(2000)
    
    # Delete script
    m.removeObject(obj)
    
    storage._toggleCutscene(False)
    storage._halt()
예제 #12
0
def rollCredits(storage, m):
    storage._go()
    m.rendering_enabled = False
    m.clearOverlays()
    ad = GlobalServices.getAudioDevice()
    tr = GlobalServices.getTextRenderer()
    x = 125
    pos = SCREEN_HEIGHT/2
    ofs = 28
    ad.play(MUSIC, 'credits', VOLUME_MUSIC + 0.1)
    tl = OverlayFactory.create("title.png", 0)
    m.addOverlay(tl)
    storage._wait(5000)
    m.removeOverlay(tl)
    storage._wait(1000)
    tr.write("Created by Marcel Schnelle", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    tr.write("at California State University, Fullerton", 0, COLOR_TEXT, (x, pos + ofs*1), FONTSTYLE_CAPTION, False)
    tr.write("for 'Introduction to Game Design & Production'", 0, COLOR_TEXT, (x, pos + ofs*2), FONTSTYLE_CAPTION, False)
    tr.write("(Fall 2012)", 0, COLOR_TEXT, (x, pos + ofs*3), FONTSTYLE_CAPTION, False)
    storage._wait(10000)
    tr.deleteAll()
    storage._wait(1000)
    tr.write("Story by Anna Martje Geudert", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    storage._wait(5000)
    tr.deleteAll()
    storage._wait(1000)
    tr.write("Resources gathered from", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    tr.write("Celianna", 0, COLOR_TEXT, (x, pos + ofs*1), FONTSTYLE_CAPTION, False)
    tr.write("Enterbrain", 0, COLOR_TEXT, (x, pos + ofs*2), FONTSTYLE_CAPTION, False)
    tr.write("Kaz", 0, COLOR_TEXT, (x, pos + ofs*3), FONTSTYLE_CAPTION, False)
    tr.write("Lunarea", 0, COLOR_TEXT, (x, pos + ofs*4), FONTSTYLE_CAPTION, False)
    tr.write("Mack", 0, COLOR_TEXT, (x, pos + ofs*5), FONTSTYLE_CAPTION, False)
    storage._wait(10000)
    tr.deleteAll()
    storage._wait(1000)
    tr.write("And the games", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    tr.write("'Cry of Fear'", 0, COLOR_TEXT, (x, pos + ofs*1), FONTSTYLE_CAPTION, False)
    tr.write("'Amnesia: The Dark Descent'", 0, COLOR_TEXT, (x, pos + ofs*2), FONTSTYLE_CAPTION, False)
    storage._wait(7500)
    tr.deleteAll()
    storage._wait(1000)
    tr.write("Inspired by", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    tr.write("Mark Fischbach", 0, COLOR_TEXT, (x, pos + ofs*1), FONTSTYLE_CAPTION, False)
    storage._wait(7500)
    tr.deleteAll()
    storage._wait(1000)
    tr.write("Thanks for playing!", 0, COLOR_TEXT, (x, pos + ofs*0), FONTSTYLE_CAPTION, False)
    ad.stop(MUSIC, 7500)
    storage._wait(7500)
    tr.deleteAll()
    storage._wait(2000)
    storage._halt()
    GlobalServices.getEventManager().post(MainMenuSwitchRequestEvent())
 def teleport(self, source, target, destination):
     self._go()
     self.teleport_in_progress = True
     set_property(PLAYER_MOVEMENT_ENABLED, False)
     
     # Save the state of the current map's properties to the persistent shelf
     # before teleporting to the new map
     update_persistent_map_properties(source, get_savegame())
     
     dur = 1000
     fadeout = OverlayFactory.create_animated_color((0,0,0), dur, 0, True, 0, 255)
     source.addOverlay(fadeout)
     self._wait(dur)
     source.rendering_enabled = False
     GlobalServices.getEventManager().post(MapChangeRequestEvent((target, destination)))
     
     set_property(PLAYER_MOVEMENT_ENABLED, True)
     source.removeOverlay(fadeout)
     
     self.teleport_in_progress = False
     self._halt()
def flashlight(storage, obj, m):
    storage._go()
    
    tr = GlobalServices.getTextRenderer()
    ad = GlobalServices.getAudioDevice()
    
    storage._faceObject(m.getPlayer(), obj)
    
    if not storage._playerInDistance(m.getPlayer().position, obj.rect):
        tr.write("I can't reach that from here.", 3)
    else:
        # Bed scare sequence done
        if storage._getData('bedroom_bedscare_done'):
            # Add the flashlight to the inventory
            m.getPlayer().inventory.add(\
                          ItemFactory.create(INVENTORY_ITEM_FLASHLIGHT, 1))
            ad.play(SOUND, 'pick_item', VOLUME_SOUND)
            tr.write("Got 'Flashlight'", 3, COLOR_GOT_ITEM)
            # Delete the note from the map
            m.removeObject(obj)
            remove_from_map(get_savegame(), OBJECT, 'bedroom', 'bedroom_flashlight')
            # Set a flag that this script was executed
            storage._setData('flashlight_obtained', True)        
            # Add the global flashlight overlay, deleting the others
            flashlight = OverlayFactory.create_flashlight()
            set_global_overlays([flashlight])
            # Add the overlay to this map, too
            m.clearOverlays()
            m.addOverlay(flashlight)
            ad.play(SOUND, 'flashlight_toggle', VOLUME_SOUND)
            ad.stop(SOUND, 1500, 'insanity_bug3')
        else:
            storage._toggleCutscene(True)
            tr.write("Sometimes I need my flashlight when the power tends to get all freaky.", 3)
            storage._wait(3000)
            tr.write("I don't know if that's because the mansion is just old or haunted, though.", 3)
            storage._toggleCutscene(False)
    
    storage._halt()
예제 #15
0
def photo(storage, obj, m):
    storage._go()
    tr = GlobalServices.getTextRenderer()
    if storage._playerInDistance(m.getPlayer().position, obj.rect, 100):
        _lastitem[0] = "photo"
        _lastitem[1] += 1
        storage._toggleCutscene(True)
        if not storage._getData('attic_photoseen'):
            tr.write("I know this photo. It was taken two years ago.", 3)
            storage._wait(3000)
            
        photo = OverlayFactory.create("photo.png", 0)
        m.addOverlay(photo, 0)
        
        tr.write("My family... everyone has been crossed out with the same red paint I've seen everywhere.", 4)
        
        storage._pauseUntilClick()
        
        m.removeOverlay(photo)
        storage._toggleCutscene(False)
        set_property(SAVE_ENABLED, False)
        storage._setData('attic_photoseen', True)
    storage._halt()
    checkEnding(storage, m)
def murderscene(storage, obj, m):
    storage._go()
    
    if not storage._getData('mirrorhall_murder_done'):
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        player = m.getPlayer()
        player.stopMoving()
        storage._toggleCutscene(True)
        shadow = m.getShadow()
        shadow.setPosition(conv_tile_pixel((24, 17), m))
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        fog = OverlayFactory.create("fog.png", pygame.BLEND_MULT)
        nolight = OverlayFactory.create("nolighting.png", 0)
        
        fl = m.getOverlay("_flashlight")
        # Helper function for looking in a direction
        def face(direction):
            fl.point(direction)
            player.setDirection(string_to_direction(direction))
            
        face("up")
        ad.play(MUSIC, 'event2', VOLUME_MUSIC)
        tr.write("Huh?", 0.5)
        storage._wait(500)
        ad.play(SOUND, 'insanity_whisper03', VOLUME_SOUND)
        storage._wait(250)
        m.addOverlay(fog)
        shadow.setVisible(True)
        shadow.moveBy((-60,0), 3750)
        ad.play(SOUND, 'scare_wood_creak_walk2', VOLUME_SOUND)
        storage._wait(750)
        tr.write("What the hell are you!?", 2)
        storage._wait(1500)
        tr.write("ANSWER ME!! Why did you kill this girl?!", 3)
        storage._wait(1500)
        ad.stop(MUSIC, 10)
        shadow.moveBy((0,70), 1000)
        ad.play(SOUND, 'scare_wood_creak_scuf3', VOLUME_SOUND)
        ad.play(SOUND, 'fb_sfx_19_false_dead01', VOLUME_SOUND - 0.1)
        towhite = OverlayFactory.create_animated_color((255,255,255), 1000, 0, True, 0, 255)
        m.addOverlay(towhite)
        ad.play(SOUND, 'insanity_ear_ring', VOLUME_SOUND_AMBIENT - 0.2, -1, 1000)
        storage._wait(1000)
        ad.play(SOUND, '21_scream10', VOLUME_SOUND - 0.4)
        m.removeOverlay(fog)
        shadow.setVisible(False)
        
        add_to_map(storage.s, OBJECT, 'mirrorhall', 'message',\
                   pygame.Rect(conv_tile_pixel((11,22), m), conv_tile_pixel((4,4), m)),\
                   'mirrorhall_message', 'message_2.png', True)
        
        player.setAnimation("lie_eyesclosed")
        
        storage._wait(5500)
        ad.stop(SOUND, 5000, 'insanity_ear_ring')
        m.removeOverlay(fl)
        totrans = OverlayFactory.create_animated_color((255,255,255), 5500, 0, True, 255, 0)
        m.addOverlay(totrans)
        m.addOverlay(nolight, 0)
        m.removeOverlay(towhite)
        ad.stop(SOUND, 5000, 'fb_sfx_19_false_dead01')
        ad.play(SOUND, '24_amb_noise', VOLUME_SOUND_AMBIENT, -1, 1000)
        storage._wait(6500)
        
        player.setAnimation("lie_eyesopen")
        storage._wait(1000)
        player.setAnimation("lie_eyesclosed")
        storage._wait(400)
        player.setAnimation("lie_eyesopen")
        storage._wait(500)
        player.setAnimation("lie_eyesclosed")
        storage._wait(100)
        player.setAnimation("lie_eyesopen")
        storage._wait(2000)
        player.setAnimation("kneel")
        tr.write("Did I... did I pass out?", 3)
        storage._wait(1500)
        
        player.setAnimation("walk")
        face("down")
        
        storage._wait(4000)
        
        ad.play(SOUND, 'flashlight_toggle', VOLUME_SOUND)
        m.addOverlay(fl)
        m.removeOverlay(nolight)
        m.removeOverlay(totrans)
        face("left-up")
        storage._wait(1000)
        face("up-right")
        storage._wait(500)
        face("down")
        storage._wait(250)
        face("down-left")
        storage._wait(300)
        face("left")
        storage._wait(750)
        face("left-up")
        storage._wait(300)
        face("up")
        storage._wait(400)
        tr.write("My head hurts so badly. Everything's a blur...", 3)
        storage._wait(3000)
        ad.stop(SOUND, 3000, '24_amb_noise')
        storage._wait(3000)
        ad.play(MUSIC, 'bgm_2', VOLUME_MUSIC, -1, 2000)
        storage._setData('mirrorhall_murder_done', True)
        storage._toggleCutscene(False)
    
    storage._halt()
def scare(storage, obj, m):
    storage._go()
    
    ad = GlobalServices.getAudioDevice()
    tr = GlobalServices.getTextRenderer()
    
    storage._toggleCutscene(True)
    
    # Force the flashlight to point to the right
    player = m.getPlayer()
    player.stopMoving()
    
    fl = m.getOverlay("_flashlight")
    # Helper function for looking in a direction
    def face(direction):
        fl.point(direction)
        player.setDirection(string_to_direction(direction))
        
    face("right")
    
    # Overlay creation
    red = OverlayFactory.create_by_color((170, 0, 0), 0, 50)
    black = OverlayFactory.create_by_color((0, 0, 0), 0, 210)
        
    # Show the figure
    ad.play(SOUND, 'scare_wood_creak_walk2', VOLUME_SOUND)
    ad.play(SOUND, '24_amb_noise', VOLUME_SOUND_AMBIENT, -1)
    shadow = m.getShadow()
    shadow.setPosition(conv_tile_pixel((43, 8), m))
    m.addOverlay(red)
    shadow.setVisible(True)
    shadow.moveBy((0, 100), 5000)
    
    storage._wait(1000)
    
    ad.stop(SOUND, 0, '24_amb_noise')
    ad.play(SOUND, '27_spark3', VOLUME_SOUND)
    ad.play(SOUND, 'scare_tingeling', VOLUME_SOUND, 0, 1000)
    m.addOverlay(black)
    m.removeOverlay(red)
    shadow.setVisible(False)
    shadow.setPosition(conv_tile_pixel((43, 14), m))
    
    storage._wait(2000)
    
    ad.play(SOUND, 'scare_wood_creak_walk3', VOLUME_SOUND)
    ad.play(SOUND, 'insanity_baby_cry2', VOLUME_SOUND)
    ad.play(SOUND, '27_orb_implode', VOLUME_SOUND)
    ad.play(SOUND, '24_amb_noise', VOLUME_SOUND_AMBIENT, -1)
    m.addOverlay(red)
    m.removeOverlay(black)
    shadow.setVisible(True)
    shadow.moveBy((-75, 0), 7500)
    
    storage._wait(2500)
    
    ad.stop(SOUND, 1750, '24_amb_noise')
    ad.play(SOUND, '27_spark4', VOLUME_SOUND)
    ad.play(SOUND, 'scare_male_terrified5', VOLUME_SOUND)
    m.addOverlay(black)
    m.removeOverlay(red)
    shadow.setVisible(False)
    
    add_to_map(get_savegame(), OBJECT, 'atrium', 'message',\
               pygame.Rect(conv_tile_pixel((29,7), m), conv_tile_pixel((8,4), m)),\
               'atrium_message', 'message_1.png', True)
    
    storage._wait(1000)
    
    m.removeOverlay(black)
    tr.write("What in the world was that thing?!", 2)
    face("left")
    storage._wait(250)
    face("up-right")
    storage._wait(250)
    face("right")
    storage._wait(100)
    face("right-down")
    storage._wait(250)
    face("right")
    storage._wait(1150)
    tr.write("Where did it go?", 2)
    storage._wait(2000)
    face("up")
    tr.write("Did it write... this?", 3)
    storage._wait(3000)
    face("right")
    
    m.removeObject(obj)
    storage._toggleCutscene(False)
    
    remove_from_map(get_savegame(), OBJECT, 'atrium', 'blockingshelf')
    storage._setData('atrium_scaredone', True)
    add_to_map(get_savegame(), OBJECT, 'atrium', 'blockingshelf',\
               pygame.Rect(conv_tile_pixel((11,25), m), conv_tile_pixel((2,8), m)),\
               'atrium_blockingshelf', 'bigshelf_right.png', True)
    
    storage._halt()
def init(storage, m):
    # If the scare hasn't been done yet and the player triggered
    # the abandoned room's canvas, this goes here
    storage._go()
    m.rendering_enabled = True
    if not storage._getData('lefthallway_scare_done') and\
       storage._getData('lefthallway_scare_enabled') and\
       not storage._getData('mirrorhall_murder_done'):
        
        # Scare
        storage._toggleCutscene(True)
        player = m.getPlayer()
        player.stopMoving()
        
        # Helper function for looking in a direction
        def face(direction):
            fl = m.getOverlay("_flashlight")
            fl.point(direction)
            player.setDirection(string_to_direction(direction))
            
        face("up")
        
        # Overlay creation
        ad = GlobalServices.getAudioDevice()
        fog = OverlayFactory.create("fog.png", pygame.BLEND_MULT)
        black = OverlayFactory.create_by_color((0, 0, 0), 0, 200)
        grad = OverlayFactory.create_animated_color((0,0,0),\
               3000, 0, True, 200, 0)
        
        ad.play(SOUND, '21_hole_loop', VOLUME_SOUND)
        ad.stop(MUSIC, 2000)
        ad.stop(SOUND, 2000, 'ambient_spooky')
        storage._wait(2000)
        
        # Show the figure
        ad.play(MUSIC, 'event1', VOLUME_MUSIC + 0.4)
        m.addOverlay(fog)
        shadow = m.getShadow()
        shadow.setPosition(conv_tile_pixel((41, 10), m))
        m.addOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(100)
        shadow.setVisible(True)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark2', VOLUME_SOUND)
        ad.play(SOUND, 'scare_wood_creak_scuf3', VOLUME_SOUND)
        shadow.moveBy((-30, 0), 2000)
        storage._wait(2000)
        shadow.moveBy((0, 1), 10)
        face("up-right")
        shadow.setVisible(False)
        storage._wait(250)
        face("up")
        storage._wait(100)
        shadow.setVisible(True)
        face("left-up")
        storage._wait(250)
        face("up")
        storage._wait(400)
        ad.play(SOUND, 'scare_wood_creak_walk2', VOLUME_SOUND)
        shadow.moveBy((0, -50), 4500)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(300)
        shadow.setVisible(False)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        storage._wait(200)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(50)
        shadow.setVisible(True)
        m.removeOverlay(black)
        storage._wait(1450)
        ad.play(SOUND, 'general_chain_rattle2', VOLUME_SOUND)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(100)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark2', VOLUME_SOUND)
        storage._wait(200)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(50)
        shadow.setVisible(False)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        storage._wait(390)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(200)
        shadow.setVisible(True)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark2', VOLUME_SOUND)
        storage._wait(777)
        m.removeOverlay(fog)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(500)
        shadow.setVisible(False)
        m.addOverlay(grad)
        m.removeOverlay(black)
        m.removeOverlay(fog)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        storage._wait(3000)
        m.removeOverlay(grad)
        ad.play(MUSIC, 'bgm_1', VOLUME_MUSIC, -1)
        ad.play(SOUND, 'ambient_spooky', VOLUME_SOUND_AMBIENT, -1, 2000)
        storage._setData('lefthallway_scare_done', True)
        storage._toggleCutscene(False)
    storage._halt()
예제 #19
0
def ending(storage, m):
    storage._go()
    GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
    storage._toggleCutscene(True)
    storage._wait(3000)
    white = OverlayFactory.create("noise.png", pygame.BLEND_MULT)
    def static(ms):
        m.addOverlay(white)
        ad.play(SOUND, 'noise', VOLUME_SOUND + 0.1, -1)
        storage._wait(ms)
        m.removeOverlay(white)
        ad.stop(SOUND, 0, 'noise')
    tr = GlobalServices.getTextRenderer()
    ad = GlobalServices.getAudioDevice()
    tr.write("W-w-what am I supposed to do now?", 3)
    storage._wait(1400)
    static(340)
    storage._wait(1600)
    tr.write("I lose track of the sharp edges around me...", 3)
    storage._wait(2000)
    towhite = OverlayFactory.create_animated_color((255,255,255),\
              1000, 0, True, 0, 255)
    m.addOverlay(towhite)
    storage._wait(1500)
    player = m.getPlayer()
    player.setPosition(conv_tile_pixel((8,9), m))
    player.setAnimation("kneel")
    storage._wait(400)
    fadeout = OverlayFactory.create_animated_color((255,255,255),\
              1000, 0, True, 255, 0)
    m.addOverlay(fadeout)
    m.removeOverlay(towhite)
    storage._wait(3000)
    tr.write("Did I...", 3)
    player.setAnimation("walk")
    storage._wait(800)
    static(200)
    storage._wait(600)
    static(40)
    storage._wait(600)
    static(1000)
    storage._wait(2500)
    player.setDirection([0,-1])
    storage._wait(500)
    tr.write("It was... me..?", 3)
    storage._wait(1000)
    static(500)
    storage._wait(3000)
    static(100)
    storage._wait(1000)
    ad.play(SOUND, 'pick_item', VOLUME_SOUND)
    remove_from_map(get_savegame(), OBJECT, 'attic', 'gun')
    tr.write("I should...", 3)
    storage._wait(3000)
    toblack = OverlayFactory.create_animated_color((0,0,0), 2500, 0, True, 0, 255)
    m.addOverlay(toblack)
    ad.stop(SOUND, 2750, 'insanity_ear_ring')
    ad.stop(MUSIC, 2750)
    storage._wait(3500)
    ad.play(SOUND, 'gun_cock', VOLUME_SOUND)
    storage._wait(3500)
    storage._halt()
    rollCredits(storage, m)
def bed(storage, obj, m):
    storage._go()
        
    tr = GlobalServices.getTextRenderer()
    ad = GlobalServices.getAudioDevice()
    player = m.getPlayer()
    storage._faceObject(player, obj)
    
    if storage._playerInDistance(player.position, obj.rect):
        if storage._getData('bedroom_bedscare_done'):
            tr.write("There is no way I'll be able to sleep with this going on.", 3)
            
        elif storage._getData('entrancenote_obtained'):
            storage._toggleCutscene(True)
            GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
            tr.write("I am not imagining these things.", 3)
            storage._wait(3000)
            tr.write("...am I?", 3)
            storage._wait(3000)
            if storage._getData('leftwing_debrisfound'):
                tr.write("The blocked path in the Left Wing...", 3)
                storage._wait(3000)
                tr.write("I didn't put that stuff there.", 3)
                storage._wait(3000)
            storage._wait(1000)
            player.setDirection([1,0])
            tr.write("I need some sleep.", 3)
            storage._wait(3000)
            togray = OverlayFactory.create_animated_color((0,0,0), 4500, 0, True, 0, 255)
            m.addOverlay(togray)
            ad.stop(MUSIC, 4500)
            ad.stop(SOUND, 4500, 'vind2')
            ad.play(SOUND, 'ambient_spooky', VOLUME_SOUND_AMBIENT, -1, 4500)
            storage._wait(6000)
            
            starty = 200
            ofs = 18
            tr.write("When I think about it, I guess it's no wonder my friends turned on me.",\
                     0, COLOR_TEXT, (200, starty))
            storage._wait(4000)
            tr.write("After all, whenever one of them stayed overnight,",\
                     0, COLOR_TEXT, (200, starty + ofs))
            storage._wait(2000)
            tr.write("nothing weird ever happened the next morning.",\
                     0, COLOR_TEXT, (200, starty + (ofs * 2)))
            storage._wait(3000)
            tr.deleteAll()
            storage._wait(1000)
            starty = 214
            tr.write("I'm afraid.",\
                     0, COLOR_TEXT, (200, starty))
            storage._wait(4000)
            tr.write("Let's hope that I can settle this tomorrow.",\
                     0, COLOR_TEXT, (200, starty + ofs))
            storage._wait(1500)
            
            bed1 = os.path.join(PATH_GRAPHICS_TILES,'bed_clyde_eyesclosed.png')
            obj.changeImage(bed1)
            player.setVisible(False)
                        
            ad.play(SOUND, 'drone', VOLUME_SOUND)
            ad.play(SOUND, 'elec', VOLUME_SOUND)
            red = OverlayFactory.create_by_color((178, 10, 5), 0, 60)
            black = OverlayFactory.create_by_color((0, 0, 0), 0, 255)
            fog = OverlayFactory.create('fog.png', pygame.BLEND_MULT)
            add_global_overlay(fog)
            m.addOverlay(fog)
            tr.deleteAll()
            storage._wait(1500)
            ad.play(SOUND, 'insanity_bug3', VOLUME_SOUND_AMBIENT - 0.1, -1, 1500)
            m.removeOverlay(togray)
            storage._wait(400)
            ad.play(SOUND, 'general_thunder2', VOLUME_SOUND)
            ad.play(SOUND, 'insanity_monster_roar02', VOLUME_SOUND)
            storage._wait(400)
            ad.play(SOUND, '27_spark2', VOLUME_SOUND)
            m.addOverlay(red)
            m.addOverlay(black)
            storage._wait(300)
            
            
            ad.play(SOUND, '27_spark4', VOLUME_SOUND)
            m.removeOverlay(black)
            storage._wait(1000)
            m.removeOverlay(red)
            
            ad.play(SOUND, '27_spark2', VOLUME_SOUND)
            m.addOverlay(black)
            storage._wait(500)
            
            # Anderes Ich hier einfügen
            shadow = m.getShadow()
            shadow.setPosition(conv_tile_pixel((13, 15), m))
            shadow.setVisible(True)
            
            ad.play(SOUND, '27_spark4', VOLUME_SOUND)
            m.removeOverlay(black)
            storage._wait(300)
            
            bed2 = os.path.join(PATH_GRAPHICS_TILES,'bed_clyde_eyesopen.png')
            obj.changeImage(bed2)
            
            m.addOverlay(red)
            shadow.setVisible(False)
            for _ in range(3):
                ad.play(SOUND, '27_spark1', VOLUME_SOUND)
                m.addOverlay(black)
                storage._wait(750)
                m.removeOverlay(black)
                ad.play(SOUND, '27_spark3', VOLUME_SOUND)
                storage._wait(100)
            ad.play(MUSIC, 'bgm_1', VOLUME_MUSIC, -1)
            m.removeOverlay(red)
            grey = OverlayFactory.create_by_color((0, 0, 0), 0, 180)
            m.addOverlay(grey)
            ad.play(SOUND, '27_spark2', VOLUME_SOUND)
            storage._wait(100)
            ad.play(SOUND, '27_spark3', VOLUME_SOUND)
            ad.play(SOUND, 'insanity_monster_roar01', VOLUME_SOUND)
            
            obj.changeImage(None, True)
            
            player.setDirection([-1,1])
            player.setVisible(True)
            
            m.removeOverlay(black)
            storage._wait(2000)
            tr.write("What was that?!", 3)
            storage._wait(3000)
            ad.play(SOUND, 'scare_breath', VOLUME_SOUND)
            tr.write("Did it... happen again?", 3)
            storage._wait(3000)
            tr.write("The power's out completely now.", 3)
            storage._wait(4500)
            player.setDirection([-1,-1])
            tr.write("I better grab my flashlight from the table if I decide to go out.", 3)
            storage._wait(4000)
            tr.deleteAll()
            storage._wait(500)
            player.setDirection([-1,0])
            
            ad.play(SOUND, 'general_thunder2', VOLUME_SOUND)
            tr.write("Grab the flashlight and head out.", 5, COLOR_OBJECTIVE)
            tr.write("[Press F5 to save your progress.]", 3, COLOR_OBJECTIVE,\
                 (0, POSITION_BOTTOM_SCREEN[1]+20))
            # 'Toggled this cutscene' switch
            storage._setData('bedroom_bedscare_done', True)
            
            storage._toggleCutscene(False)
        else:
            tr.write("My bed used to be so comfortable. I don't sleep very well at the moment.", 5)
    else:
        tr.write("My bed. I can't reach it from here.", 3)
        
    storage._halt()
def init(storage, m):
    storage._go()

    # Skip the intro if it has been played
    if storage._getData('bedroom_introduction_done'):
        m.rendering_enabled = True
        storage._halt()
        return
    
    # Introduction sequence
    storage._toggleCutscene(True)
    
    tr = GlobalServices.getTextRenderer()
    
    black = OverlayFactory.create_by_color((0,0,0), 0, 255)
    m.addOverlay(black)
    
    m.addAmbientSound(SOUND, "vind2", VOLUME_SOUND_AMBIENT, -1, FADEIN_TIME)
    storage._wait(5000)
    
    m.rendering_enabled = True
    
    starty = 200
    ofs = 18
    
    tr.write("...How long this has been going on?", 0, COLOR_TEXT, (200, starty))
    storage._wait(5000)
    tr.write("I have no idea, to be honest.", 0, COLOR_TEXT, (200, starty+ofs))
    storage._wait(5000)
    tr.write("It started right after I inherited my grandfather's mansion.",\
              0, COLOR_TEXT, (200, starty+ofs*2))
    storage._wait(5000)
    tr.deleteAll()
    storage._wait(2000)
    tr.write("This place is way too big for myself, so I have friends over on occasion.",\
              0, COLOR_TEXT, (200, starty))
    storage._wait(5000)
    tr.write("I really don't know why they keep messing with me,",\
              0, COLOR_TEXT, (200, starty+ofs))
    storage._wait(5000)
    tr.write("but whenever I wake up after they were over, everything is...",\
              0, COLOR_TEXT, (200, starty+ofs*2))
    storage._wait(3500)
    fadein = OverlayFactory.create_animated_color((0,0,0), 17500, 0, True, 255, 150)
    m.addOverlay(fadein)
    m.removeOverlay(black)
    m.addAmbientSound(MUSIC, "intro", VOLUME_MUSIC, -1, FADEIN_TIME)
    storage._wait(1500)
    tr.write("different.",\
              0, COLOR_TEXT, (200, starty+ofs*3))
    storage._wait(5000)
    tr.deleteAll()
    storage._wait(2000)
    tr.write(" They're coming over again tonight.",\
              0, COLOR_TEXT, (200, starty))
    storage._wait(5000)
    tr.write("I'll confront them with what they're doing to me.",\
              0, COLOR_TEXT, (200, starty+ofs))
    storage._wait(5000)
    tr.write("It bothers me, getting fooled all the time, by the ones I thought were my dearest.",\
              0, COLOR_TEXT, (200, starty+ofs*2))
    storage._wait(5000)
    fadein2 = OverlayFactory.create_animated_color((0,0,0), 2000, 0, True, 150, 0)
    m.switchOverlays([(fadein, fadein2)])
    m.addOverlay(fadein2)
    tr.deleteAll()
    
    storage._setData('bedroom_introduction_done', True)
    
    storage._wait(2000)
    
    tr.write("Meet the others downstairs.", 5, COLOR_OBJECTIVE)
    tr.write("[Press W,A,S,D to move. Click on highlighted objects when close to them to interact.]", 5, COLOR_OBJECTIVE,\
                 (0, POSITION_BOTTOM_SCREEN[1]+20))
    
    m.removeOverlay(fadein2)
    
    storage._toggleCutscene(False)
    
    storage._halt()
def powercutshort(storage, obj, m):
    storage._go()
    ad = GlobalServices.getAudioDevice()
    tr = GlobalServices.getTextRenderer()
    
    if storage._getData('entrancenote_obtained')\
    and not storage._getData('rightwing_powershortage'):
        storage._toggleCutscene(True)
        p = m.getPlayer()
        p.stopMoving()
        storage._setData('rightwing_powershortage', True)
        
        ad.play(SOUND, 'drone', VOLUME_SOUND)
        ad.play(SOUND, 'elec', VOLUME_SOUND)
        
        black = OverlayFactory.create_by_color((0,0,0), 0, 255)
        m.addOverlay(black)
        storage._wait(1000)
        
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark1', VOLUME_SOUND)
        storage._wait(100)
        m.addOverlay(black)
        storage._wait(1500)
        
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark2', VOLUME_SOUND)
        storage._wait(50)
        m.addOverlay(black)
        storage._wait(20)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(30)
        m.addOverlay(black)
        storage._wait(50)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        m.removeOverlay(black)
        storage._wait(400)
        m.addOverlay(black)
        storage._wait(20)
        m.removeOverlay(black)
        ad.play(SOUND, '27_spark4', VOLUME_SOUND)
        storage._wait(30)
        m.addOverlay(black)
        ad.play(SOUND, '27_spark3', VOLUME_SOUND)
        storage._wait(50)
        fadein = OverlayFactory.create_animated_color((0,0,0), 3000, 0, True, 255, 155)
        storage._wait(600)
        m.removeOverlay(black)
        m.addOverlay(fadein)
        
        storage._wait(3000)
        
        tr.write("What was that? A... power shortage?", 3)
        storage._wait(500)
        p.setDirection([1,0])
        storage._wait(500)
        p.setDirection([1,1])
        storage._wait(500)
        p.setDirection([-1,0])
        storage._wait(500)
        p.setDirection([1,0])
        storage._wait(500)
        p.setDirection([0,-1])
        storage._wait(500)
        tr.write("Keep going, Clyde... it's nothing.", 3)
        remove_from_map(get_savegame(), SCRIPT, 'rightwing', 'rightwing_powercutshort')
        add_global_overlay(OverlayFactory.create_by_color((0,0,0), 0, 155))
        storage._toggleCutscene(False)
        
    storage._halt()
def note(storage, obj, m):
    storage._go()
    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        tr = GlobalServices.getTextRenderer()
        ad = GlobalServices.getAudioDevice()
        
        tr.deleteAll()
        
        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)
        
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)
        
        # Text of the note
        y = 150
        ofs = 18
        tr.write("Marnie:",\
                 0, COLOR_TEXT, (100, y + (ofs*0)))
        tr.write("Last night, I caught Cly wandering around the house again.",\
                 0, COLOR_TEXT, (100, y + (ofs*2)))
        tr.write("He did not respond at all when I addressed him and asked what he was doing.",\
                 0, COLOR_TEXT, (100, y + (ofs*3)))
        tr.write("His eyed were wide open but he did not react at all. I put him back to bed.",\
                 0, COLOR_TEXT, (100, y + (ofs*4)))
        tr.write("The next morning, I asked him about the incident. He did not remember any of it,",\
                 0, COLOR_TEXT, (100, y + (ofs*6)))
        tr.write("although he claimed to be very tired that day.",\
                 0, COLOR_TEXT, (100, y + (ofs*7)))
        tr.write("This is the third time it happened when he slept over at our house.",\
                 0, COLOR_TEXT, (100, y + (ofs*8)))
        tr.write("I'm telling you, something is troubling this poor child.",\
                 0, COLOR_TEXT, (100, y + (ofs*9)))
        tr.write("Please, my dear, get this kid to the doctor.",\
                 0, COLOR_TEXT, (100, y + (ofs*10)))
        tr.write("- Harold",\
                 0, COLOR_TEXT, (100, y + (ofs*12)))
        
        # Wait for user input
        storage._pauseUntilClick()
        
        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
        
        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, 'journal_page', VOLUME_SOUND)        
        # Delete texts
        tr.deleteAll()
        
        if not storage._getData('library_notefound'):
            tr.write("Marnie...? My mother's name was Marnie.", 3)
            storage._wait(3000)
            tr.write("And Harold is my grandfather...", 3)
            storage._wait(3000)
            tr.write("They both vanished not too long ago.", 3)
            storage._wait(4500)
            tr.write("I feel strange.", 3)
            storage._setData('library_notefound', True)
        storage._toggleCutscene(False)
    storage._halt()
def entrancenote(storage, obj, m):
    storage._go()

    storage._faceObject(m.getPlayer(), obj)
    tr = GlobalServices.getTextRenderer()

    if storage._playerInDistance(m.getPlayer().position, obj.rect):
        # Cutscene toggle: Disable user input
        storage._toggleCutscene(True)
        ad = GlobalServices.getAudioDevice()

        tr.write("There is a note on the ground.", 3)
        storage._wait(3000)
        tr.write("Did someone slide this under the entrance door?", 3)
        storage._wait(4000)
        tr.deleteAll()

        # Overlays
        note = OverlayFactory.create("note_big.png")
        togray = OverlayFactory.create_animated_color((0, 0, 0), 1000, 0, True, 0, 200)
        m.addOverlay(note)
        m.addOverlay(togray)

        # Play sound
        ad.play(SOUND, "journal_page", VOLUME_SOUND)

        # Text of the note
        y = 120
        ofs = 18
        tr.write("Clyde,", 0, COLOR_TEXT, (100, y))
        tr.write("you know we like you. However, you kinda freak us out, dude.", 0, COLOR_TEXT, (100, y + (ofs * 2)))
        tr.write(
            "We have grown sick of your accusations and want to give you some time", 0, COLOR_TEXT, (100, y + (ofs * 3))
        )
        tr.write("for yourself to sort things out and get your mind straight.", 0, COLOR_TEXT, (100, y + (ofs * 4)))
        tr.write(
            "Why would you keep blaming us for shit that's obviously not real?", 0, COLOR_TEXT, (100, y + (ofs * 6))
        )
        tr.write(
            "What good would it do us if we, like you said we do, 'keep changing things in the house'?",
            0,
            COLOR_TEXT,
            (100, y + (ofs * 7)),
        )
        tr.write(
            "Never ever has any of us witnessed anything suspicious when we gave in",
            0,
            COLOR_TEXT,
            (100, y + (ofs * 8)),
        )
        tr.write(
            "to your begging us to stay overnight. What, are you frightened of your",
            0,
            COLOR_TEXT,
            (100, y + (ofs * 9)),
        )
        tr.write("grandpa's house and see spooky things that aren't even there?", 0, COLOR_TEXT, (100, y + (ofs * 10)))
        tr.write(
            "We don't want to say this, but we ain't gonna stay for tonight.", 0, COLOR_TEXT, (100, y + (ofs * 11))
        )
        tr.write("Get it together, man.", 0, COLOR_TEXT, (100, y + (ofs * 13)))

        # Wait for user input
        storage._pauseUntilClick()

        GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))

        # Delete note overlay
        m.removeOverlay(note)
        m.removeOverlay(togray)
        # Play sound
        ad.play(SOUND, "journal_page", VOLUME_SOUND)
        # Delete texts
        tr.deleteAll()
        # Fadeout music
        ad.stop(MUSIC, 12000)
        ad.stop(SOUND, 12000, "vind2")
        # More text
        tr.write("Did they...?", 3)
        storage._wait(4000)
        tr.write("They have forsaken me.", 3)
        storage._wait(4000)
        tr.write("I didn't want to upset them... it's just...", 3)
        storage._wait(4000)
        tr.write("I am NOT making this up. Something is wrong here.", 3)
        storage._wait(4000)
        tr.deleteAll()
        storage._wait(1000)
        m.getPlayer().setDirection([0, -1])
        tr.write("I feel dizzy. I should get back to bed.", 3)
        storage._wait(4000)
        storage._faceObject(m.getPlayer(), obj)
        # Delete texts
        tr.deleteAll()
        # Add the note to the inventory
        m.getPlayer().inventory.add(ItemFactory.create(INVENTORY_ITEM_ENTRANCE_NOTE, 1))
        ad.play(SOUND, "pick_paper", VOLUME_SOUND)
        tr.write("Got 'Note (Forsaken Friends)'", 3, COLOR_GOT_ITEM)
        tr.write("[Press TAB to access your possessions.]", 3, COLOR_OBJECTIVE, (0, POSITION_BOTTOM_SCREEN[1] + 20))

        # Delete the note from the map
        m.removeObject(obj)
        # Set a flag that this script was executed
        storage._setData("entrancenote_obtained", True)
        # End cutscene
        storage._toggleCutscene(False)
        # Play a new BGM
        ad.play(MUSIC, "ambienceloop", VOLUME_MUSIC, -1)
    else:
        tr.write("Is that a note on the ground?", 3)
    storage._halt()