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 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 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 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 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 global_inits(self, m, handlerAv=False): GlobalServices.getEventManager().post(ObjectHighlightedEvent(None)) # Check if the current global overlays are already equivalent to the map's ones if m.overlays != get_global_overlays(): # Remove overlays m.clearOverlays() # Add global overlays for o in get_global_overlays(): m.addOverlay(o) m.flushOverlayQueue() # If no other handler init method is attached to this init, # this method does the enabling of map rendering (so that you can see stuff) if not handlerAv: m.rendering_enabled = True
def ladder(storage, obj, m): storage._go() if storage._playerInDistance(m.getPlayer().position, obj.rect): tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() if storage._getData('masterroom_ladder_needed'): storage._toggleCutscene(True) tr.write("This ladder should get me up through that loft hatch.", 3) storage._wait(3000) inv = m.getPlayer().inventory inv.add(ItemFactory.create(INVENTORY_ITEM_LADDER, 1)) remove_from_map(get_savegame(), OBJECT, 'rightwing', 'ladder') ad.play(SOUND, 'pick_item', VOLUME_SOUND) tr.write("Got 'Ladder'", 3, COLOR_GOT_ITEM) storage._toggleCutscene(False) GlobalServices.getEventManager().post(ObjectHighlightedEvent(None)) else: tr.write("There is a ladder on the ground. I have no purpose for that right now.", 3) storage._halt()
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 checkClick(self, event): return_list = None # If Left-Mouse-Click and an item is highlighted if event.button == 1 and self.mouseover is not None: self.ad.play(SOUND, "menu_select", VOLUME_SOUND - 0.4) return_list = [] # Add the index of the clicked-on item depending on the current screen if self.loadmenu_open: # If the back button was clicked, change to MainMenu again by posting a ToggleEvent if self.mouseover == self.menu_backbutton: GlobalServices.getEventManager().post(LoadMenuToggleEvent()) else: return_list.append(1) return_list.append(self.mouseover[7]) elif self.newgame_open: # If the back button was clicked, change to MainMenu again by posting a ToggleEvent if self.mouseover == self.menu_backbutton: GlobalServices.getEventManager().post(NewGameToggleEvent()) else: return_list.append(self.buttons.index(self.mouseover)) return return_list
def ceilingdoor(storage, obj, m): storage._go() if storage._playerInDistance(m.getPlayer().position, obj.rect, 180): GlobalServices.getEventManager().post(ObjectHighlightedEvent(None)) inv = m.getPlayer().inventory tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() storage._toggleCutscene(True) if inv.containsName(INVENTORY_ITEM_LADDER): m.getPlayer().setPosition(conv_tile_pixel((9,15), m)) # Add ladder to this map ad.play(SOUND, '05_attach_ladder', VOLUME_SOUND) from src.model.Clickable import TeleportClickable ladderpath = os.path.join(PATH_GRAPHICS_TILES, 'ladder_vertical.png') laddersurf = pygame.image.load(ladderpath).convert_alpha() ladder = TeleportClickable('tpattic',\ pygame.Rect(conv_tile_pixel((9, 7), m),\ conv_tile_pixel( (2, 7), m)),\ m, None, 'ladder_climb',\ 'attic', 8*16, 17*16, laddersurf,\ ladderpath, True) add_object_to_map_properties(get_savegame(), 'masterroom',\ TELEPORTOBJECT, ladder) remove_from_map(get_savegame(), OBJECT, 'masterroom', 'ceilingdoor') # Reset player blah inv.remove(inv.get(INVENTORY_ITEM_LADDER)) else: tr.write("There is a loft hatch on the ceiling.", 3) storage._wait(3000) tr.write("I need something to get up there.", 3) if not storage._getData('masterroom_ladder_needed'): storage._wait(3000) ad.play(MUSIC, 'bgm_3', VOLUME_MUSIC, -1) storage._setData('masterroom_ladder_needed', True) storage._toggleCutscene(False) storage._halt()
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 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()
def openLoadMenu(self): # TextRenderer handle tr = GlobalServices.getTextRenderer() # Get all directories in "saves" unfiltered first dirs = glob(os.path.join(PATH_SAVES, "*")) # Save the valid directories in this list: valid_dirs = [] # Save the valid tuples (information on the save games) in this list: valid_tuples = [] # Position attributes and increment variables or positioning start_pos = (80, 65) offset = (250, 80) x = 0 y = 0 # Validate these directories (check the files inside of them) for direction in dirs: delete = False name = os.path.basename(direction) path = os.path.join(direction, name) # A valid save game shelf consists of three data files and a screen shot thumbnail for ext in [".bak", ".dat", ".dir", ".png"]: file = "%s%s" % (path, ext) if not os.path.exists(file): delete = True break if not delete: valid_dirs.append((path, name)) if len(valid_dirs) == 0: # If no valid directories are left, post a NoSavesFoundEvent to the Event Manager GlobalServices.getEventManager().post(NoSavesFoundEvent()) else: # Delete the previous texts tr.deleteAll() # Reset the highlighted object self.mouseover = None # If there are some left, build the menu structure self.loadmenu_open = True # Sort the valid dirs by modification time first valid_dirs.sort(key=lambda x: os.path.getmtime("%s%s" % (x[0], ".png"))) valid_dirs.reverse() for d in valid_dirs: path = d[0] name = d[1] # Create pygame Surface object from the screenshot file screenshot = "%s%s" % (path, ".png") shot_surf = pygame.image.load(screenshot).convert() # Create Text surface from name name_surf = tr.writeAsSurface(name) # Format the modified time string and grab a surface for that as well mt = time.strftime("%m/%d/%Y %I:%M:%S %p", time.localtime(os.path.getmtime(screenshot))) mt_surf = tr.writeAsSurface(mt) # Construct positioning of the surfaces position_img = (start_pos[0] + x * offset[0], start_pos[1] + y * offset[1]) rect_img = pygame.Rect(position_img, shot_surf.get_rect().size) position_name = (position_img[0] + 100, position_img[1] + 10) position_mtime = (position_name[0], position_name[1] + 20) # Construct the tuple new_tuple = (path, shot_surf, rect_img, name_surf, position_name, mt_surf, position_mtime, name) valid_tuples.append(new_tuple) # Increment the offset variables y += 1 if y % 5 == 0: x += 1 y = 0 self.loadmenu_saves = valid_tuples
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 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 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()