def printLoadScreen(position): from Maingame import stdscr from Maingame import curses from Maingame import nextLine curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE) if position == 1: for lineno, line in enumerate(loadScreenLayout1): stdscr.addstr(loadScreenLayout1[lineno], curses.color_pair(1)) nextLine() elif position == 2: for lineno, line in enumerate(loadScreenLayout2): stdscr.addstr(loadScreenLayout2[lineno], curses.color_pair(1)) nextLine() elif position == 3: for lineno, line in enumerate(loadScreenLayout3): stdscr.addstr(loadScreenLayout3[lineno], curses.color_pair(1)) nextLine() elif position == 4: for lineno, line in enumerate(loadScreenLayout4): stdscr.addstr(loadScreenLayout4[lineno], curses.color_pair(1)) nextLine() elif position == 5: for lineno, line in enumerate(loadScreenLayout5): stdscr.addstr(loadScreenLayout5[lineno], curses.color_pair(1)) nextLine()
def printTitleScreen(position): from Maingame import stdscr from Maingame import curses from Maingame import nextLine curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE) if position == 1: for lineno, line in enumerate(titleScreenLayout1): stdscr.addstr(titleScreenLayout1[lineno], curses.color_pair(1)) nextLine() elif position == 2: for lineno, line in enumerate(titleScreenLayout2): stdscr.addstr(titleScreenLayout2[lineno], curses.color_pair(1)) nextLine()
def block(player): from Maingame import stdscr from Maingame import getchar from Maingame import curses stdscr.addstr("Do you want to block? You'll take 1/4 damage but can't attack",curses.color_pair(1)) stdscr.addstr("1 to block, anything else to not") block = getchar() if block == 1: player.isBlocking = True
def saveScreen(): from Maingame import stdscr from Maingame import curses curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE) stdscr.addstr("saving... Wait 10 seconds before closing ", curses.color_pair(1))
def classChoice(): from Maingame import stdscr from Maingame import curses from Maingame import nextLine from Maingame import getchar doLoop = True nextLine() stdscr.addstr("Choose your class (1, 2, 3, or 4):", curses.color_pair(1)) nextLine() nextLine() stdscr.addstr("1) Warrior", curses.color_pair(1)) nextLine() nextLine() stdscr.addstr("2) Sorcerer", curses.color_pair(1)) nextLine() nextLine() stdscr.addstr("3) Rogue", curses.color_pair(1)) nextLine() nextLine() stdscr.addstr("4) Necromancer", curses.color_pair(1)) stdscr.refresh() classChoice = 7 chosenCorrectly = True while chosenCorrectly: classChoice = getchar() if classChoice == "1" or classChoice == "2" or classChoice == "3" or classChoice == "4": chosenCorrectly = False if classChoice == "1": nextLine() nextLine() stdscr.addstr("Name your warrior: ", curses.color_pair(1)) stdscr.refresh() nameChoice = stdscr.getstr() nameChoice = nameChoice.decode("utf-8") player = Entities.Warrior(nameChoice) return player elif classChoice == "2": nextLine() nextLine() stdscr.addstr("Name your sorcerer: ", curses.color_pair(1)) stdscr.refresh() nameChoice = stdscr.getstr() nameChoice = nameChoice.decode("utf-8") player = Entities.Sorcerer(nameChoice) stdscr.addstr("character has been made", curses.color_pair(1)) return player elif classChoice == "3": nextLine() nextLine() stdscr.addstr("Name your rogue: ", curses.color_pair(1)) stdscr.refresh() nameChoice = stdscr.getstr() nameChoice = nameChoice.decode("utf-8") player = Entities.Rogue(nameChoice) return player elif classChoice == "4": nextLine() nextLine() stdscr.addstr("Name your necromancer: ", curses.color_pair(1)) stdscr.refresh() nameChoice = stdscr.getstr() nameChoice = nameChoice.decode("utf-8") player = Entities.Necromancer(nameChoice) return player
def levelUp(leveler): from Maingame import stdscr from Maingame import curses stdscr.addstr ("You leveled up to level "+str((leveler.level)+1)+"!!", curses.color_pair(1)) leveler.level += 1