def relaxlever(storage, obj, m): storage._go() if not storage._getData('library_relaxlever_pressed')\ and storage._playerInDistance(m.getPlayer().position, obj.rect): ad = GlobalServices.getAudioDevice() ad.play(SOUND, 'pull_switch', VOLUME_SOUND) # Change graphics downswitch = os.path.join(PATH_GRAPHICS_TILES,'switch_down.png') obj.changeImage(downswitch) shelf = m.getObjectByName('shelf') ad.play(SOUND, 'shelf', VOLUME_SOUND) # Re-position the shelf m.removeObject(shelf, True) add_to_map(get_savegame(), OBJECT, 'libraryupstairs', 'shelf',\ pygame.Rect(conv_tile_pixel((47,10), m), conv_tile_pixel((4,6), m)),\ 'libraryupstairs_shelf', 'bigshelf_four.png', True) # Add the next lever (that was behind the moved shelf) add_to_map(get_savegame(), OBJECT, 'libraryupstairs', 'officelever',\ pygame.Rect(conv_tile_pixel((45,11), m), conv_tile_pixel((1,2), m)),\ 'libraryupstairs_officelever', 'switch_up.png', True) storage._accessData() storage._setData('library_relaxlever_pressed', True) storage._halt()
def officelever(storage, obj, m): storage._go() if storage._playerInDistance(m.getPlayer().position, obj.rect): if not storage._getData('library_officelever_pressed'): storage._toggleCutscene(True) ad = GlobalServices.getAudioDevice() ad.play(SOUND, 'pull_switch', VOLUME_SOUND) # Change graphics for this lever downswitch = os.path.join(PATH_GRAPHICS_TILES,'switch_down.png') obj.changeImage(downswitch) # Grab the shelf in atrium.tmx and delete it remove_object_from_map_properties(get_savegame(), 'atrium',\ OBJECT, 'mastershelf', True) # Add the TeleportClickable to that map from src.model.Clickable import TeleportClickable, Clickable tele = TeleportClickable('tpmasterroom',\ pygame.Rect(conv_tile_pixel((24, 4), m),\ conv_tile_pixel( (2, 3), m)),\ None, 'atrium_tpmasterroom', 'doormove6',\ 'masterroom', 32*16, 35*16) add_object_to_map_properties(get_savegame(), 'atrium',\ TELEPORTOBJECT, tele) # Add vandalized painting image painting = get_object_from_map_properties(get_savegame(), 'librarydownstairs','painting') vandalized = os.path.join(PATH_GRAPHICS_TILES, 'vandalizedpainting.png') painting.changeImage(vandalized) update_object_in_map_properties(get_savegame(), 'librarydownstairs', painting) # Add new wall texts on this map and librarydownstairs.tmx add_to_map(get_savegame(), OBJECT, 'libraryupstairs', 'message',\ pygame.Rect(conv_tile_pixel((43,36), m), conv_tile_pixel((14,5), m)),\ 'libraryupstairs_message', 'message_3.png', True) # Add the scare script add_to_map(get_savegame(), SCRIPT, 'libraryupstairs', 'scare',\ pygame.Rect(conv_tile_pixel((38,14), m), conv_tile_pixel((1,6), m)),\ 'libraryupstairs_scare') message4path = os.path.join(PATH_GRAPHICS_TILES, 'message_4.png') message4 = pygame.image.load(message4path).convert_alpha() othermsg = Clickable('message', pygame.Rect(conv_tile_pixel((22,18), m),\ conv_tile_pixel((6,6), m)),\ 'librarydownstairs_message', None, message4, message4path) add_object_to_map_properties(get_savegame(), 'librarydownstairs',\ OBJECT, othermsg) # Toggle this event as "happened" storage._setData('library_officelever_pressed', True) storage._toggleCutscene(False) storage._halt()
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()