Example #1
0
def init():	#Start game, make screen 80x25
	os.system("mode con: lines=25 cols=80")
	set_color(Colors['White'], Colors['Black'])
	
	r = show_main_menu()	#Show menu, if Start, proceed, else, quit.
	if (r):
		start_tutorial()
Example #2
0
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.
Example #3
0
def show_tut_world():
	old = colorize.current
	for plot in _g['tworld']:
		if plot == '.' or plot == 'H':	#Go through the world list, draw each index with correct color.
			set_color(Colors['Gray'])
		elif plot == ':':
			set_color(Colors['Green'])
		else:
			set_color(Colors['Magenta'])
		write(plot)
	set_color(old[0],old[1])
Example #4
0
def show_world():
	old = colorize.current
	#print(''.join(_g['dworld']))
	for plot in _g['dworld']:
		if plot == '.' or plot == 'H':
			set_color(Colors['Gray'])
		elif plot == ':':
			set_color(Colors['Green'])
		else:
			set_color(Colors['Magenta'])
		write(plot)
	set_color(old[0],old[1])
Example #5
0
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
	
Example #6
0
def show_intro():
	set_color(Colors['BWhite'], Colors['White'])
	flakes = []										#Make a list of flakes to be.
	flake_pattern = ('\\','|','/','-')				#What the possible flakes could look like.
	dorfx = -10										#Set cutscene guy position.
	dorfy = 12
	color_stages = (Colors['BWhite'], Colors['White'], Colors['Gray'], Colors['Black'])	#Make a list of stages the colors will go through.
	color_stage = 0.0	#Index of color stage.
	
	while (_g['state'] == 0):	#While in cutscene.
		flakes.append([80,(int.from_bytes(os.urandom(1), byteorder='big') // 10),random.randint(0,3)])		#Try a different random method. Add a flake on a random Y
		if ((int.from_bytes(os.urandom(1), byteorder='big') // 64) == 0): 					# 1/4 Chance
			flakes.append([80,(int.from_bytes(os.urandom(1), byteorder='big') // 10),0])	#Add more than one flake randomly.
		scr = list("."*24*80)																#Make the screen as a series of .'s
		for flake in flakes:																#Go through all created flakes.
			flake[0]-=2																		#Move them left.
			if (flake[0]>=0 and flake[0]<=79 and flake[1]>=0 and flake[1]<=23):				#If on the screen.
				flake[2]+=1																	#Change flake pattern
				if (flake[2] > len(flake_pattern)-1):										#If it's out of range, make it 0 to be in range.
					flake[2] = 0
				scr[flake[0]+(flake[1]*80)] = flake_pattern[flake[2]]						#Set the position on the screen equal to the flake's pattern.
		if (dorfx >= 0):
			scr[int(dorfx)+(dorfy*80)]="\x02"	#If he's in screen, draw him.
		if (dorfx < 50):						#If he's less than 50 X, move him. If he's more than 43, move him slower.
			dorfx+=(.4-((dorfx>43)*.3))
			if ((int.from_bytes(os.urandom(1), byteorder='big') // 32) == 0):		#Chance to move vertically. Chance of a Chance to move in a direction.
				if ((int.from_bytes(os.urandom(1), byteorder='big') // 128) == 1):
					dorfy = min(dorfy+1,20)
				else:
					dorfy = max(dorfy-1,5)
		else:
			set_color(color_stages[min(3,int(color_stage))], color_stages[min(3,int(color_stage+1))])	#Screen begins to fade, set colors.
			color_stage += .05																			#Increment screen fading.
			if (color_stage >= 5):
				_g['state'] = 1		#Fading ended, so does cutscene.
		os.system('cls')
		write([''.join(scr)])		#Draw the screen list onto the screen.
		time.sleep(.1)
Example #7
0
def show_intro():
	set_color(Colors['BWhite'], Colors['White'])
	flakes = []
	flake_pattern = ('\\','|','/','-')
	dorfx = -10
	dorfy = 12
	color_stages = (Colors['BWhite'], Colors['White'], Colors['Gray'], Colors['Black'])
	color_stage = 0.0
	
	while (_g['state'] == 0):
		flakes.append([80,(int.from_bytes(os.urandom(1), byteorder='big') // 10),0])	
		if ((int.from_bytes(os.urandom(1), byteorder='big') // 64) == 0): # 1/4 Chance
			flakes.append([80,(int.from_bytes(os.urandom(1), byteorder='big') // 10),0])			
		scr = list("."*24*80)
		for flake in flakes:
			flake[0]-=2
			if (flake[0]>=0 and flake[0]<=79 and flake[1]>=0 and flake[1]<=23):
				flake[2]+=1
				if (flake[2] > len(flake_pattern)-1):
					flake[2] = 0
				scr[flake[0]+(flake[1]*80)] = flake_pattern[flake[2]]
		if (dorfx >= 0):
			scr[int(dorfx)+(dorfy*80)]="\x02"
		if (dorfx < 50):
			dorfx+=(.4-((dorfx>43)*.3))
			if ((int.from_bytes(os.urandom(1), byteorder='big') // 32) == 0):
				if ((int.from_bytes(os.urandom(1), byteorder='big') // 128) == 1):
					dorfy = min(dorfy+1,20)
				else:
					dorfy = max(dorfy-1,5)
		else:
			set_color(color_stages[min(3,int(color_stage))], color_stages[min(3,int(color_stage+1))])
			color_stage += .05
			if (color_stage >= 6):
				_g['state'] = 1
		os.system('cls')
		write([''.join(scr)])
		time.sleep(.1)
Example #8
0
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.
Example #9
0
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.
Example #10
0
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")
Example #11
0
import os, msvcrt, ctypes, struct, sys, random, time
import colorize, puzzles
from colorize import Colors, set_color, set_cursor, set_cursor_attr

os.system("mode con: lines=25 cols=80")

def write(arr):
	for strs in arr:
		sys.stdout.write(strs)
	sys.stdout.flush() #Push it out, otherwise colors will be put onto wrong rows.

set_color(Colors['White'], Colors['Black'])

_g = {
	'mm_ind' : 0,
	'state' : 0,
	'world' : '',
	'dworld' : ''
}

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 //"])
Example #12
0
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)