def begin(): global completed if (completed != 0): write("I can't deal with the creepers anymore.") puzzles.functions.wait() return os.system('cls') write("Oh jeeze what now. Who is this clown? Dressed in a clown suit in the middle\nof a forest.") puzzles.functions.wait() write("\n\nHe gestures me over. Whatever. Let's get this over with.\nHe begins talking.. But I have other plans") puzzles.functions.wait() time.sleep(1) os.system('cls') write("Press the corresponding keys on the keyboard as they appear on the screen.\nPressing them quickly will net you a better score.") puzzles.functions.wait() time.sleep(1) os.system('cls') time.sleep(1) set_color(4) write("\tWELCOME") time.sleep(1) write("\n\t\tTO") time.sleep(1) write("\n\t\t\tPUNCH PUNCH") time.sleep(1) write("\n\t\t\t\t\t~REVOLUTION~") time.sleep(2) os.system('cls') score = 0 letter = -1 timer = 0 start = time.clock() set_cursor_attr(100,False) while score < 30: set_color(6) set_cursor(0,0) write(["SCORE: ",score," "*20]) if (letter == -1): timer = time.clock() letter = random.randint(0,25) else: set_color(8) set_cursor(40,5) write(chr(letter+97)) if msvcrt.kbhit(): keycode = int.from_bytes(msvcrt.getch(), byteorder='big') if (keycode >= 97 and keycode <= 122): if (keycode-97 == letter): score += int(((timer+4)-time.clock())) letter = -1 os.system('cls') write(["Congratulations, you punched out the creeper in ",str(int((time.clock()-start)*10)/10)," seconds!"]) time.sleep(1) puzzles.functions.wait() return True
def start(x, y): coord = world._g['world'][(y*5)+x] #Change an X,Y into an integer. if (coord >= 0 and coord <= len(puzzles.pl)-1): #Make sure you're not somehow going out of range set_cursor_attr(100) #Make cursor a big block. world._g['puzzle'] = coord #Set curren puzzle. r = puzzles.pl[coord]() #Start it. Get result. if (r == "End"): show_ending() return True if (r): world._g['dworld'][(y*5)+x] = 1 #If True, mark as completed expand_map(x,y) #Expand the map to explore new areas. goto_map() #And go to it. else: goto_map() #If you 'map'ed or 'Esc'ed then go back to map.
def print_main_menu(): set_cursor_attr(100,False) #Turn cursor off. os.system('cls') w = 80 #Constant for width of console. write([ "/"*w, "//"," "*((w-20)//2)," Insignificance "," "*((w-20)//2),"//", #Add Blanks to pad the text to the center. "/"*w ]) set_color(Colors['Gray'], Colors['Black']) #Write my name in gray. write([" "*(w-15),"// Jamie Phy //"]) set_color(Colors['White'], Colors['Black']) write([" Main Menu \x18\x19"]) set_color(Colors['Gray'], Colors['Black']) write([" "*(w-32),"///////////////\n"]) set_color(Colors['White'], Colors['Black']) if (_g['mm_ind'] == 0): print("\t\x10 Start\n\t Exit") #If the cursor is over start, show it. else: print("\t Start\n\t\x10 Exit") #Otherwise put the cursor on Exit.
def print_main_menu(): set_cursor_attr(100,False) os.system('cls') w = 80 write([ "/"*w, "//"," "*((w-46)//2)," Some Game Name That Serves No Importance "," "*((w-46)//2),"//", "/"*w ]) set_color(Colors['Gray'], Colors['Black']) write([" "*(w-15),"// Jamie Phy //"]) set_color(Colors['White'], Colors['Black']) write([" Main Menu \x18\x19"]) set_color(Colors['Gray'], Colors['Black']) write([" "*(w-32),"///////////////\n"]) set_color(Colors['White'], Colors['Black']) if (_g['mm_ind'] == 0): print("\t\x10 Start\n\t Exit") else: print("\t Start\n\t\x10 Exit")
def goto_map(): set_cursor_attr(100,False) #Don't display cursor. os.system('cls') map_input() #Handle map movement