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