def blit_dialogues(): """ Draw dialogues onto the screen. """ if len(player.dialogues) > 0: libtcod.console_clear(0) dlg = player.dialogues[-1] if dlg.npc_picture: icon = libtcod.image_load(os.path.join('data', 'images', dlg.npc_picture)) else: icon = libtcod.image_load(os.path.join('data', 'images', 'icon-%s.png' % (dlg.npc_name))) frame = libtcod.image_load(os.path.join('data', 'images', 'dialogue-frame.png')) libtcod.image_blit_rect(frame, 0, 0, 0, -1, -1, libtcod.BKGND_SET) libtcod.image_blit_rect(icon, 0, C.MAP_LEFT, C.MAP_TOP, -1, -1, libtcod.BKGND_SET) # title libtcod.console_print_ex(0, 2 + (C.MAP_WIDTH / 2), 2, libtcod.BKGND_NONE, libtcod.CENTER, "%c%s says:%c" % (C.COL4, dlg.npc_name, C.COLS)) # # the message # libtcod.console_print_ex(0, 2 + (C.MAP_WIDTH / 2), C.MAP_TOP + 4, # libtcod.BKGND_NONE, libtcod.CENTER, # "\"%c%s%c\"" % (C.COL5, dlg.dialogue, C.COLS)) try: libtcod.console_print_rect( 0, 4, 6, C.MAP_WIDTH - 4, C.MAP_HEIGHT - 2, "%s" % (dlg.dialogue)) except e: print('dialogue string format error: %s' % (e)) # press space libtcod.console_print_ex(0, 2 + (C.MAP_WIDTH / 2), C.SCREEN_HEIGHT - 1, libtcod.BKGND_NONE, libtcod.CENTER, "(spacebar or enter...)")
def blit_help(): """ Show help. """ libtcod.console_clear(0) icon = libtcod.image_load(os.path.join('data', 'images', 'stats-frame.png')) libtcod.image_blit_rect(icon, 0, C.MAP_LEFT, C.MAP_TOP, -1, -1, libtcod.BKGND_SET) libtcod.console_print_ex(0, C.SCREEN_WIDTH / 2, 2, libtcod.BKGND_NONE, libtcod.CENTER, "%cTop Dog%c\nv%s\n^_^" % (C.COL5, C.COLS, C.VERSION)) # helptext = ["%c%s%s" % (C.COL5, C.COLS, C.VERSION)] helptext = ["The %cPuppy%c has been kidnapped by the %cFat Cat Mafioso%c. You travel from yard to yard, searching for the crafty Cats!" % (C.COL4, C.COLS, C.COL1, C.COLS)] helptext.append("\nYou are the %c@%c sign. Walk into other animals to interact with them." % (C.COL3, C.COLS)) helptext.append("\n%cKEYPAD%c" % (C.COL5, C.COLS)) helptext.append("\nUse the %cKeypad%c to move, this is preferred as \ diagonals are the dog's bark. Keypad 5 shows your stats, as does [i]nfo. The %cARROW%c keys also move you." \ % (C.COL4, C.COLS, C.COL4, C.COLS)) helptext.append("\n%cACTIONS%c" % (C.COL5, C.COLS)) helptext.append("\n[%cd%c]rink water" % (C.COL5, C.COLS)) helptext.append("[%ce%c]at food" % (C.COL5, C.COLS)) helptext.append("[%cp%c]piddle to relieve yourself" % (C.COL5, C.COLS)) helptext.append("[%ci%c]nfo screen: stats and quests" % (C.COL5, C.COLS)) helptext.append("\nThe keypad also map to actions, use this mnemonic to remember:") helptext.append("\n%cD%crink and %cD%civide\n%cE%cat and %cM%cultiply\n%cP%ciddling %cS%coothes ;)" % (C.COL1, C.COLS, C.COL1, C.COLS , C.COL2, C.COLS, C.COL2, C.COLS , C.COL3, C.COLS, C.COL3, C.COLS)) helptext.append("\nNow go find that %cPuppy!%c" % (C.COL5, C.COLS)) helptext.append("\nWOOF!") libtcod.console_print_rect(0, 4, 10, C.MAP_WIDTH - 4, C.MAP_HEIGHT - 2, "\n".join(helptext))
"in 'The Lost Puppy'") def blit_about(): libtcod.console_clear(0) icon = libtcod.image_load(os.path.join('data', 'images', 'about-frame.png')) libtcod.image_blit_rect(icon, 0, 0, 0, -1, -1, libtcod.BKGND_SET) try: readme = file('README', 'r') except IOError, e: libtcod.console_print_ex(0, 2, 2, libtcod.BKGND_NONE, libtcod.LEFT, "Error: about file not found :'(") return None readme_text = readme.read() readme.close() libtcod.console_print_rect(0, 2, 2, C.MAP_WIDTH - 3, C.MAP_HEIGHT - 4, readme_text) libtcod.console_print_ex(0, 2, 47, libtcod.BKGND_NONE, libtcod.LEFT, "%cspace%c to return" % (C.COL4, C.COLS)) def draw_map(): """ Draw the map tiles onto the canvas. """ for y in range(C.MAP_HEIGHT - 0): for x in range(C.MAP_WIDTH - 0): tile = game_map[x][y] if player.wizard or libtcod.map_is_in_fov(fov_map, x, y): tile.seen = True