def openNewGame(self): # Reset the highlighted object self.mouseover = None # Init new game menu stuff self.newgame_open = True self.newgame_name = [] GlobalServices.getTextRenderer().deleteAll()
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 render(self, screen): # Draw a temp text GlobalServices.getTextRenderer().write("Inventory", 0, COLOR_TEXT,\ (100,100), FONTSTYLE_CAPTION) # Draw background image screen.blit(self.bg, (0,0)) # Order every item to draw itself properly on a 4x2 grid l = ((x,y) for y in range(2) for x in range(4)) for i in self.items: i.render(screen, next(l))
def handle(self, event): if isinstance(event, FullscreenToggleRequestEvent): # Order the Game menu to check if that's possible self.gh.fullscreenToggleRequest() # Handle a selected item in the main menu if isinstance(event, MainMenuSelectionEvent): # Main Menu Items: self.handleMainMenuSelection(event.object) elif isinstance(event, NoSavesFoundEvent): # Delete the save folder again and output a "No loading blah" message GlobalServices.getTextRenderer().write("There are no saved games to be loaded.", 2, COLOR_RED)
def handle(self, event): # Handle tick and quit events first super(MainMenuViewHandler, self).handle(event) # Mouse motion events: Order the current view to check if a button was hovered over if isinstance(event, MouseMotionEvent): self.v.currentView.checkMotion(event.object.pos) # Mouse click event elif isinstance(event, MouseClickEvent): # Check if the user has clicked on an actual menu item. l = self.v.currentView.checkClick(event.object) # If the return value is not none, he actually has. Therefore, post the selection event! if l is not None: self.v.evManager.post(MainMenuSelectionEvent(l)) # Load menu toggle event elif isinstance(event, LoadMenuToggleEvent): # Flip the status self.loadmenu_open = not self.loadmenu_open if self.loadmenu_open: self.v.currentView.openLoadMenu() else: self.v.currentView.closeLoadMenu() # New game menu toggle event elif isinstance(event, NewGameToggleEvent): # Flip the status self.newgame_open = not self.newgame_open if self.newgame_open: self.v.currentView.openNewGame() else: self.v.currentView.closeNewGame() # Adding a character to the save game name elif isinstance(event, CharAddEvent): GlobalServices.getAudioDevice().play(SOUND, "char_enter", VOLUME_SOUND) self.v.currentView.addChar(event.object) # Removing a character from the save game name elif isinstance(event, CharDelEvent): GlobalServices.getAudioDevice().play(SOUND, "char_enter", VOLUME_SOUND) self.v.currentView.remChar() # Submitting the current save game name elif isinstance(event, CharEnteringCompleteEvent): savegame = self.v.currentView.getChars() # If the save game name is empty, display error message if savegame[1] in ["", "_"]: GlobalServices.getTextRenderer().write("You must enter a name for your save game.", 3, COLOR_RED) else: GlobalServices.getAudioDevice().play(SOUND, "game_start", VOLUME_SOUND) self.v.evManager.post(MainMenuSelectionEvent(savegame)) elif isinstance(event, NoSavesFoundEvent): self.loadmenu_open = False
def handle(self, event): # Catch MapLoadingDoneEvents and notify the Game object # to change the current map to the event's object. if isinstance(event, MapLoadingDoneEvent): map_object = event.object[0] callback = None if len(event.object) > 1: callback = event.object[1] self.gh.changeMap(map_object, callback) # Catch MapLoadingFailedEvents and write out to the screen # that this particular map doesn't exist (yet) elif isinstance(event, MapLoadingFailedEvent): self.gh.currentmap.rendering_enabled = True self.gh.changeMap(self.gh.currentmap, None, False) GlobalServices.getTextRenderer().write("Couldn't load %s.tmx" % event.object, 4)
def init(storage, m): storage._go() tr = GlobalServices.getTextRenderer() # Skip the credits if they played already if storage._getData('righthallway_introduction_done'): m.rendering_enabled = True storage._halt() return storage._setData('righthallway_introduction_done', True) m.rendering_enabled = True storage._wait(500) x = 450 l = [tr.write("Story:", 5, COLOR_TEXT, (x, 360), FONTSTYLE_NORMAL, False),\ tr.write("Anna Martje Geudert", 5, COLOR_TEXT, (x, 380), FONTSTYLE_CAPTION, False)] storage._wait(2500) for t in l: tr.delete(t) storage._wait(500) l = [tr.write("Graphics:", 5, COLOR_TEXT, (x, 300), FONTSTYLE_NORMAL, False),\ tr.write("Celianna", 5, COLOR_TEXT, (x, 320), FONTSTYLE_CAPTION, False),\ tr.write("Enterbrain", 5, COLOR_TEXT, (x, 350), FONTSTYLE_CAPTION, False),\ tr.write("Kaz", 5, COLOR_TEXT, (x, 380), FONTSTYLE_CAPTION, False),\ tr.write("Lunarea", 5, COLOR_TEXT, (x, 410), FONTSTYLE_CAPTION, False),\ tr.write("Mack", 5, COLOR_TEXT, (x, 440), FONTSTYLE_CAPTION, False)] storage._wait(2500) for t in l: tr.delete(t) storage._wait(500) l = [tr.write("Sound & Music:", 5, COLOR_TEXT, (x, 360), FONTSTYLE_NORMAL, False),\ tr.write("Marcel Schnelle", 5, COLOR_TEXT, (x, 380), FONTSTYLE_CAPTION, False),\ tr.write("'Cry of Fear'", 5, COLOR_TEXT, (x, 410), FONTSTYLE_CAPTION, False),\ tr.write("'Amnesia: The Dark Descent'", 5, COLOR_TEXT, (x, 440), FONTSTYLE_CAPTION, False)] storage._wait(2500) for t in l: tr.delete(t) storage._wait(500) l = [tr.write("Programming:", 5, COLOR_TEXT, (x, 360), FONTSTYLE_NORMAL, False),\ tr.write("Marcel Schnelle", 5, COLOR_TEXT, (x, 380), FONTSTYLE_CAPTION, False)] storage._wait(2500) for t in l: tr.delete(t) storage._halt()
def tplibrary(storage, m, obj): storage._go() retval = False tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() if storage._playerInDistance(m.getPlayer().position, obj.rect): if storage._getData('library_open'): retval = True else: inventory = m.getPlayer().inventory if inventory.containsName(INVENTORY_ITEM_LIBRARY_KEY): storage._toggleCutscene(True) ad.play(SOUND, "pick_key", VOLUME_SOUND) tr.write("The library key fits into the lock.", 3) storage._wait(3000) key = inventory.get(INVENTORY_ITEM_LIBRARY_KEY) key.subQty(1) storage._setData('library_open', True) storage._toggleCutscene(False) retval = True else: ad.play(SOUND, "lockeddoor", VOLUME_SOUND) tr.write("The door is locked. 'Library' is spelt on the door frame.", 3) storage._halt() return retval
def tpstorage(storage, m, obj): storage._go() tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() inv = m.getPlayer().inventory retval = False if storage._playerInDistance(m.getPlayer().position, obj.rect): if storage._getData('storage_open'): retval = True elif inv.containsName(INVENTORY_ITEM_STORAGE_KEY): storage._toggleCutscene(True) ad.play(SOUND, "keypickup", VOLUME_SOUND) tr.write("I can use the storage key here.", 3) storage._wait(3000) key = inv.get(INVENTORY_ITEM_STORAGE_KEY) key.subQty(1) storage._setData('storage_open', True) storage._toggleCutscene(False) retval = True else: ad.play(SOUND, "lockeddoor", VOLUME_SOUND) tr.write("The storage has been locked for as long as I can remember. I have never been in there.", 4) retval = False storage._halt() return retval
def __init__(self): ViewInterface.__init__(self) self.tr = GlobalServices.getTextRenderer() self.logo = self.tr.write("Loading", 0, COLOR_TEXT, (200, 200), FONTSTYLE_CAPTION) self.name = None self.img = pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "loading_screen_bg.png")).convert_alpha() self.pos = center_image(self.img)
def switch(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() if storage._playerInDistance(m.getPlayer().position, obj.rect): if storage._getData('guestroom_switch_pressed'): tr.write("I pulled the lever. It won't budge now.", 3) else: storage._toggleCutscene(True) tr.write("It's... a lever?", 3) storage._wait(3000) if storage._getData('guestroom_foundshelf'): tr.write("Does this do something with the hinges on that bookshelf?", 3) storage._wait(3000) ad.play(SOUND, 'pull_switch', VOLUME_SOUND) # Change graphics downswitch = os.path.join(PATH_GRAPHICS_TILES,'switch_down.png') obj.changeImage(downswitch) shelfchange = os.path.join(PATH_GRAPHICS_TILES,'shelf_atriumkey_inside.png') shelf_object = m.getObjectByName('keyshelf') shelf_object.changeImage(shelfchange, True) ad.play(SOUND, 'shelf', VOLUME_SOUND) storage._setData('guestroom_switch_pressed', True) storage._toggleCutscene(False) else: tr.write("I can't reach that from here.", 3) 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 = 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 tpmasterroom(storage, m, obj): storage._go() retval = True if not storage._getData('atrium_masterroom_firstentered'): storage._toggleCutscene(True) tr = GlobalServices.getTextRenderer() tr.write("The lever in the library has moved the shelf out of the way.", 3) storage._wait(3000) tr.write("This means that I can enter the master office.", 3) storage._wait(3000) tr.write("I'm barely awake right now. What does all of this mean?", 3) storage._wait(3000) m.getPlayer().setDirection([0,1]) m.getOverlay("_flashlight").point("down") tr.deleteAll() storage._wait(2000) m.getPlayer().setDirection([0,-1]) m.getOverlay("_flashlight").point("up") tr.write("...", 3) storage._wait(3000) storage._toggleCutscene(False) ad = GlobalServices.getAudioDevice() ad.stop(MUSIC, 5000) storage._setData('atrium_masterroom_firstentered', True) storage._halt() return retval
def save(self, disp=False): # Get the savegame data temp = get_savegame() # Open the "real" shelf (the one the player can load up again)! save = shelve.open(CURRENT_SHELF_FILENAME[0]) # Save persistent data that needs to be stored in order to retrieve the game state. # All data that is used to do that is actually the player's current position, # the current map where this position applies, and the currently playing background # music. # Pre-defined keys for the dict save['player_position'] = self.player.position save['current_map'] = self.currentmap.properties['key_name'] save['player_inventory'] = self.player.inventory save['current_sounds'] = GlobalServices.getAudioDevice().getPlayingSounds() temp['global_overlays'] = get_global_overlays() # Update the persistent map properties for the current map update_persistent_map_properties(self.currentmap, temp) # Copy the rest of the shelf data to the "correct" save file copy_to_shelve(temp, save) # Close the shelves again; that's it! save.close() if disp: # Display the optional success message using the TextRenderer module tr = GlobalServices.getTextRenderer() tr.write("Game saved.", 3)
def __init__(self): # Initialize via superclass constructor ViewInterface.__init__(self) # Write out the logo and menu items using the TextRenderer module self.writeTexts() # Menu item highlighted by the user, or "None" self.mouseover = None # BG image self.bg = pygame.transform.smoothscale( pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "main_menu_bg.png")), (SCREEN_WIDTH, SCREEN_HEIGHT) ).convert() # Title image self.title = pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "title.png")) # Load menu stuff. First, Boolean if it is open self.loadmenu_open = False tr = GlobalServices.getTextRenderer() self.loadmenu_caption = tr.writeAsSurface("Where do you want to pick up?", COLOR_TEXT, FONTSTYLE_CAPTION) back = tr.writeAsSurface("Back", COLOR_TEXT, FONTSTYLE_CAPTION) self.menu_backbutton = (back, pygame.Rect((500, 20), back.get_rect().size)) # The list of save game folders to choose from self.loadmenu_saves = [] # New game menu stuff. Boolean if it is open self.newgame_open = False self.newgame_caption = tr.writeAsSurface( "Enter a save game name. Proceed with Enter...", COLOR_TEXT, FONTSTYLE_CAPTION ) # List of characters that make up the save game name self.newgame_name = [] self.newgame_surf = tr.writeAsSurface("_") # Play BGM self.ad = GlobalServices.getAudioDevice() self.ad.play(MUSIC, "maincredit", VOLUME_MUSIC + 0.2, -1)
def tpatrium(storage, m, obj): storage._go() ad = GlobalServices.getAudioDevice() tr = GlobalServices.getTextRenderer() retval = False if storage._playerInDistance(m.getPlayer().position, obj.rect): # Key if storage._getData('atrium_open'): retval = True else: inventory = m.getPlayer().inventory if inventory.containsName(INVENTORY_ITEM_ATRIUM_KEY): storage._toggleCutscene(True) ad.play(SOUND, "pick_key", VOLUME_SOUND) tr.write("I can use the atrium key here.", 3) storage._wait(3000) key = inventory.get(INVENTORY_ITEM_ATRIUM_KEY) key.subQty(1) storage._setData('atrium_open', True) storage._toggleCutscene(False) retval = True else: ad.play(SOUND, "lockeddoor", VOLUME_SOUND) tr.write("The door to the atrium... it's locked? That's weird, it shouldn't be.", 3) storage._halt() return retval
def message(storage, obj, m): storage._go() if storage._playerInDistance(m.getPlayer().position, obj.rect, 140): tr = GlobalServices.getTextRenderer() tr.write("'YOU DISGUST ME...'") storage._halt()
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 message(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() if storage._playerInDistance(m.getPlayer().position, obj.rect, 100): tr.write("'YOU KNOW WHAT YOU DID'", 3) storage._halt()
def closet(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() if not storage._playerInDistance(m.getPlayer().position, obj.rect): tr.write("I can't reach that from here.", 3) else: tr.write("My closet of random stuff. Nothing of interest here.", 3) storage._halt()
def blockingdebris(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() if storage._playerInDistance(m.getPlayer().position, obj.rect): tr.write("The path is blocked by several shelves that weren't here before.", 3) storage._setData('leftwing_debrisfound', True) storage._halt()
def writeTexts(self): tr = GlobalServices.getTextRenderer() # self.logo = tr.write(APP_NAME.upper(), 0, COLOR_TEXT, (200, 200), FONTSTYLE_LOGO) self.buttons = [] x = 100 self.buttons.append(tr.write("Begin", 0, COLOR_TEXT, (x, 300), FONTSTYLE_CAPTION, False)) self.buttons.append(tr.write("Load", 0, COLOR_TEXT, (x, 325), FONTSTYLE_CAPTION, False)) # self.buttons.append(tr.write("Settings", 0, COLOR_TEXT, (x, 350), FONTSTYLE_CAPTION, False)) self.buttons.append(tr.write("Quit", 0, COLOR_TEXT, (x, 350), FONTSTYLE_CAPTION, False))
def canvas(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() if storage._playerInDistance(m.getPlayer().position, obj.rect): storage._toggleCutscene(True) tr.write("Do these symbols contain a message?", 3) storage._toggleCutscene(False) storage._setData('lefthallway_scare_enabled', True) storage._halt()
def paintingd(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() storage._faceObject(m.getPlayer(), obj) if storage._playerInDistance(m.getPlayer().position, obj.rect): tr.write("These are two paintings of my grandparents in their prime.", 3) else: tr.write("I can't reach that from here.", 3) storage._halt()
def switch(storage, obj, m, index): # (Extra "index" parameter depicts the # of the switch that was triggered # from 1 (far left) to 5 (far right)) storage._go() if not storage._getData('lefthallway_puzzle_solved'): if storage._playerInDistance(m.getPlayer().position, obj.rect): ad = GlobalServices.getAudioDevice() # Initialize the persistent representation of this puzzle if it doesn't exist yet states = storage._getData('lefthallway_switches') if states is None: # -1: down, 0: middle, 1: up states = [0, 0, 0, 0, 0] # Change the state of the switch that was passed in # (subtract 1 from the index b/c computer scientists love to start at 0!) state = states[index-1] state += 1 if state > 1: state = -1 states[index-1] = state storage._setData('lefthallway_switches', states) # Change graphic for that switch if state == -1: image = 'switch_down.png' elif state == 0: image = 'switch_mid.png' else: image = 'switch_up.png' gfx = os.path.join(PATH_GRAPHICS_TILES, image) ad.play(SOUND, 'pull_switch', VOLUME_SOUND) obj.changeImage(gfx) # Solution to the switch puzzle (from left to right): # up down down up up # (The gender of the five people on the portrait # are mapped to the positioning of the switches. # The encoding of gender is hinted at in the abandoned chamber.) solution = [1, -1, -1, 1, 1] if states == solution: # Puzzle solved storage._toggleCutscene(True) ad.play(SOUND, 'doorstop3', VOLUME_SOUND) lastdir = m.getPlayer().getDirection() m.getPlayer().setDirection(string_to_direction("up-right")) storage._wait(250) ad.play(SOUND, '07_pick_lock', VOLUME_SOUND) storage._wait(500) tr = GlobalServices.getTextRenderer() tr.write("Something has happened. I think this is the correct combination.", 3) m.getPlayer().setDirection(string_to_direction(lastdir)) storage._setData('lefthallway_puzzle_solved', True) storage._toggleCutscene(False) storage._halt()
def tpupperbalcony(storage, source, obj): storage._go() retval = False tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() if storage._playerInDistance(source.getPlayer().position, obj.rect): ad.play(SOUND, "lockeddoor", VOLUME_SOUND) tr.write("The door won't budge.", 3) storage._halt() return retval
def closetr(storage, obj, m): storage._go() tr = GlobalServices.getTextRenderer() storage._faceObject(m.getPlayer(), obj) if storage._playerInDistance(m.getPlayer().position, obj.rect): tr.write("An empty closet. Nothing of interest here.", 3) else: tr.write("I can't reach that from here.", 3) 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 librarykey(storage, obj, m): storage._go() if storage._playerInDistance(m.getPlayer().position, obj.rect): tr = GlobalServices.getTextRenderer() ad = GlobalServices.getAudioDevice() ad.play(SOUND, 'pick_key', VOLUME_SOUND) tr.write("Got 'Library Key'", 3, COLOR_GOT_ITEM) m.getPlayer().inventory.add(ItemFactory.create(INVENTORY_ITEM_LIBRARY_KEY, 1)) remove_from_map(get_savegame(), OBJECT, 'mirrorhall', 'librarykey') storage._setData('librarykey_obtained', True) 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())