コード例 #1
0
ファイル: puzzle_16.py プロジェクト: madolinn/Development
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
	
コード例 #2
0
ファイル: asdf.py プロジェクト: madolinn/Development
def start_tutorial():
	create_world()
	show_world()
	set_cursor(0,0)
	write("Welcome to Insignificance.\nWhat you're looking at right now is the world map.\n")
	wait()
	write("\nThe H in the center represents your starting camp. The map is currently bare\nbecause you have yet to explore the world.\n")
	wait()
	os.system('cls')
	_g['dworld'][coord(39,12)] = '.'
	_g['dworld'][coord(38,12)] = ':'
	_g['dworld'][coord(38,11)] = '.'
	
	_g['dworld'][coord(41,12)] = '?'
	_g['dworld'][coord(40,11)] = '?'
	_g['dworld'][coord(40,13)] = '?'
	_g['dworld'][coord(39,11)] = '?'
	_g['dworld'][coord(39,13)] = '?'
	_g['dworld'][coord(38,13)] = '?'
	_g['dworld'][coord(38,10)] = '?'
	_g['dworld'][coord(37,11)] = '?'
	_g['dworld'][coord(37,12)] = '?'
	show_world()
	set_cursor(0,0)
	write("Upon completing puzzles, new locations will become available for you to\nexplore. These will be marked with magenta [?]s.\n")
	wait()
	write("\nThe game is not a straight path though. Be sure to revisit locations that have\nnot been marked completed, but have already been partially solved, after\nacquring new items. They could prove useful in these places. These will be\nrepresented by green [:]s.\n")
	wait()
	start_puzzle(0)
コード例 #3
0
ファイル: main.py プロジェクト: madolinn/Development
def start_tutorial():	#Create fake world, explain how the world works.
	create_tut_world()
	show_tut_world()
	set_cursor(0,0)
	write("Welcome to Insignificance.\nWhat you're looking at right now is the world map.\n")
	puzzles.functions.wait()
	write("\nThe H in the center represents your starting camp. The map is currently bare\nbecause you have yet to explore the world.\n")
	puzzles.functions.wait()
	os.system('cls')
	_g['tworld'][coord(39,12)] = '.'
	_g['tworld'][coord(38,12)] = ':'
	_g['tworld'][coord(38,11)] = '.'
	
	_g['tworld'][coord(41,12)] = '?'
	_g['tworld'][coord(40,11)] = '?'
	_g['tworld'][coord(40,13)] = '?'
	_g['tworld'][coord(39,11)] = '?'
	_g['tworld'][coord(39,13)] = '?'
	_g['tworld'][coord(38,13)] = '?'
	_g['tworld'][coord(38,10)] = '?'
	_g['tworld'][coord(37,11)] = '?'
	_g['tworld'][coord(37,12)] = '?'
	show_tut_world()
	set_cursor(0,0)
	write("Upon completing puzzles, new locations will become available for you to\nexplore. These will be marked with magenta [?]s.\n")
	puzzles.functions.wait()
	write("\nThe game is not a straight path though. Be sure to revisit locations that have\nnot been completed, green [:]'s, after finding new items.")
	puzzles.functions.wait()
	write("\n\nIf you get stuck on a puzzle, just type [map] or press the Escape\nbutton to go back to the world.")
	puzzles.functions.wait()
	puzzles.functions.start(2,2)
コード例 #4
0
ファイル: functions.py プロジェクト: madolinn/Development
def testInput(ans):
	global entry_string
	set_cursor(0,20)
	while (True):													#msvcrt.getch() grabs keypress events for us.
		keycode = int.from_bytes(msvcrt.getch(), byteorder='big')	#Convert it to an int so we can more easily compare.
		if (keycode >= 97 and keycode <= 122):						#97 = a, 122 = z. Just make sure it's a letter.
			if (len(entry_string) < 15):							#Make sure someone isn't filling up the screen for some reason.
				write(chr(keycode))
				entry_string += chr(keycode)						#Convert from int:keycode to a letter, add to entry_string
				screen_refresh()
		elif (keycode == 8):	#Backspace keycode.
			do_backspace()
		elif (keycode == 13):	#Enter keycode.
			r = submit_entry()
			if (entry_string == ans and r == True):					#If it passed submit_entry, and the answer is the answer we're looking for, return true
				entry_string = ""
				return True
			if (entry_string == "map"):								#If we typed in "map" go back to map.
				entry_string = ""
				return False
			entry_string = ""
			screen_refresh()
		elif (keycode == 27):										#Esc, handle as if "map".
			entry_string = ""
			return False
コード例 #5
0
ファイル: functions.py プロジェクト: madolinn/Development
def show_ending():		#Show the end dialog. It's on a time sequence for failed suspense.
	os.system('cls')
	write("Jeeze, it's snowing pretty hard. Even my hide jacket isn't protecting me.")
	time.sleep(4)
	write("\nWait, I was just in a cave on a mountain.. Where am I!")
	time.sleep(4)
	write("\nWhat! Am I going crazy? There's nothing behind me, I swear..")
	time.sleep(4)
	write("\nThis is inanse.. Is that someone up ahead?")
	time.sleep(3)
	write("\n'Hey!'  ")
	time.sleep(1)
	write("'HEY")
	time.sleep(1)
	write("Y")
	time.sleep(1)
	write("Y")
	time.sleep(1)
	write("Y!'")
	time.sleep(5)
	write("\nNo reply. I'll try and catch up...")
	time.sleep(4)
	write("so cold..")
	time.sleep(4)
	write("I can't..")
	time.sleep(7)
	write("-poof-")
	time.sleep(7)
	os.system('cls')
	set_cursor(39,5)
	set_color(0,4)
	write("End")
	wait()
	os._exit(1)	#Kill system because python does weird things and won't exit properly on its own.
コード例 #6
0
ファイル: functions.py プロジェクト: madolinn/Development
def show_suggestions():		#Make a auto-complete suggestion box for inputted text.
	sug = []
	if (len(entry_string) > 0):
		for item in sorted(world._g['inv']):		#Sort the list alphabetically, loop.
			esL = len(entry_string)
			if (len(sug) > 3):
				break
			if (entry_string == item[:esL].lower()):	#If the entry_string matches the substring of an item name
				sug.append(item)						#Add that item name to the suggestions
	while (len(sug) < 4):
		sug.append("")
	for ind, item in enumerate(sug):						#Write out suggestions 'bottom up'.
		set_cursor(5,19-ind)
		write('\t'+item+(" "*(20-len(item))))
コード例 #7
0
ファイル: functions.py プロジェクト: madolinn/Development
def draw_map():
	set_cursor(37,7)			#Set cursor to somewhere in the middle.
	for ind, visi in enumerate(world._g['dworld']):
		if (ind % 5 == 0):		#If it's the first index of a row, set the cursor's position.
			set_cursor(37,7+(ind//5))
		if (ind == 12):			#Special case for your Home.
			set_color(8)
			write("H")
			continue
		if (ind == 7 and visi == 1):	#Special case for merchants.
			set_color(2)
			write(":")
			continue
		if (ind == 23 and visi == 1):	#Special case for leatherworkers.
			set_color(2)
			write(":")
			continue
		if (visi == -1 or (world._g['world'][ind]==-1)):	#Make sure that we're not revealing maps we don't have discovered, or ones that don't have a puzzle.
			write(" ")
		elif (visi == 0):	#If visible but not completed
			set_color(5)
			write("?")
		elif (visi > 0):	#If completed
			set_color(8)
			write(".")
	set_color(7)
	set_cursor(world._g['x']+37,world._g['y']+7)	#Move cursor to current position. Draw face.
	write("\x02")
	set_cursor(0,0)
コード例 #8
0
ファイル: main.py プロジェクト: madolinn/Development
def refreshScreen():
	os.system('cls')							#Tell CMD to clear the screen.
	showWrong()
	print("\n\nYour Phrase:")
	print("\t"+_g["revealed"])					#Feed the user what letters he has discovered.
	conv = "abcdefghijklmnopqrstuvwxyz"
	colorize.set_cursor(0,15)					#Set the cursor to COORD 0,15
	for ind, let in enumerate(conv):			#Enumerate the list again, as before.
		if (_g["guessed"][ind] == 0):			#If you haven't guessed, set color to gray.
			colorize.set_color(8)
		elif (_g["guessed"][ind] == 1):			#If the letter is in the phrase, set color to green.
			colorize.set_color(2)
		elif (_g["guessed"][ind] == 2):			#If the letter is not in the phrase, set color to red.
			colorize.set_color(4)
		colorize.write(let)						#Write the letter
		colorize.set_color(7)					#Set color to default.
コード例 #9
0
ファイル: functions.py プロジェクト: madolinn/Development
def show_answer_text(it):								#Respond to an answer with flavor text.
	set_cursor(1,15)
	write(" "*79)
	if (world._g['puzzle']+1 < len(it)):				#Make sure that there's an index for the response.
		if (it[world._g['puzzle']+1] != ""):			#If so, say it.
			set_cursor(1,15)
			print(it[world._g['puzzle']+1])
			return
	set_cursor(1,15)									#If not, display "What."
	print("What.")
コード例 #10
0
ファイル: functions.py プロジェクト: madolinn/Development
def screen_refresh():		#Reprint the screen from scratch.
	show_suggestions()
	set_cursor(0,20)
	write([entry_string,(" "*15)])
	set_cursor(len(entry_string),20)
コード例 #11
0
ファイル: main.py プロジェクト: madolinn/Development
def showWrong():
	colorize.set_cursor(0,1)
	colorize.write(noose)	#Draw my noose at (0,1)
	if (_g["wrong"] >= 1):	#Draw pieces of Sir Wiggles for each one wrong, up to 10.
		colorize.set_cursor(15,3)
		colorize.write("O")
	if (_g["wrong"] >= 2):
		colorize.set_cursor(15,4)
		colorize.write("|")
	if (_g["wrong"] >= 3):
		colorize.set_cursor(15,5)
		colorize.write("|")
	if (_g["wrong"] >= 4):
		colorize.set_cursor(16,6)
		colorize.write("\\")
	if (_g["wrong"] >= 5):
		colorize.set_cursor(17,6)
		colorize.write("_")
	if (_g["wrong"] >= 6):
		colorize.set_cursor(18,6)
		colorize.write("/")
	if (_g["wrong"] >= 7):
		colorize.set_cursor(19,5)
		colorize.write("|")
	if (_g["wrong"] >= 8):
		colorize.set_cursor(20,4)
		colorize.write("_")
	if (_g["wrong"] >= 9):
		colorize.set_cursor(21,4)
		colorize.write("_")
	if (_g["wrong"] >= 10):
		colorize.set_cursor(22,5)
		colorize.write("\\")
	colorize.set_cursor(0,10)	#Set the cursor back to where it should be.
コード例 #12
0
ファイル: main.py プロジェクト: madolinn/Development
def showEndGame():
	if (_g["wrong"] == 10):	#If you lost, say so, ask if you want to play again.
		os.system('cls')
		print("\n\nOh no! Sir Wiggles has\n been hung. The correct\n phrase was: \n"+_g["phrase"]+"\n\n     Would you like to\n        play again?")
	else:
		os.system('cls')	#Draw fancy Sir Wiggles
		colorize.set_cursor(12,3)
		colorize.write("O")
		colorize.set_cursor(12,4)
		colorize.write("|")
		colorize.set_cursor(12,5)
		colorize.write("|")
		colorize.set_cursor(13,6)
		colorize.write("\\")
		colorize.set_cursor(14,6)
		colorize.write("_")
		colorize.set_cursor(15,6)
		colorize.write("/")
		colorize.set_cursor(16,5)
		colorize.write("|")
		colorize.set_cursor(17,4)
		colorize.write("_")
		colorize.set_cursor(18,4)
		colorize.write("_")
		colorize.set_cursor(19,5)
		colorize.write("\\")
		colorize.set_cursor(0,10)
		colorize.write("Hurray you saved Sir\n Wiggles from death by\n hanging. ")
		if (_g["wrong"] > 0):	#Display how many times Sir Wiggles was injured if a wrong guess came up.
			s = ""
			if (_g["wrong"] > 1):	#Grammar.
				s = "s"
			colorize.write("He was only\n injured "+str(_g["wrong"])+" time"+s+".")
		print("\n\n     Would you like to\n        play again?")
	getRetry()	#Ask if you want to retry, regardless of win or loss.