Example #1
0
def run():	
	while True:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:	#Quit if you leave the window
				pygame.quit()
				quit()				
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)	#Clear buffer
				
		output2d.draw_images()
		output2d.draw_inv_text()
				
		
		if pygame.key.get_pressed()[pygame.K_UP]:
			if hallway_type not in [Hallways.LEFT, Hallways.RIGHT, Hallways.BIFURC]:
				step(Directions.FORWARDS, pygame.K_UP)

		elif pygame.key.get_pressed()[pygame.K_DOWN] and maze.position.adjacent[Directions.BACKWARDS] != None:
			step(Directions.BACKWARDS,pygame.K_DOWN)
			
		elif pygame.key.get_pressed()[pygame.K_LEFT]:
			if hallway_type not in [Hallways.STRAIGHT, Hallways.RIGHT, Hallways.RIGHT_BIFURC]:
				step(Directions.LEFT, pygame.K_LEFT)
				
		elif pygame.key.get_pressed()[pygame.K_RIGHT]:
			if hallway_type not in [Hallways.STRAIGHT, Hallways.LEFT, Hallways.LEFT_BIFURC]:
				step(Directions.RIGHT, pygame.K_RIGHT)
		
		hallway_type = maze.current_type()
		
		GLComponents.hallway(hallway_type, True, maze.position.colours)
			
		pygame.display.flip()	#Refresh screen
		pygame.time.wait(25)
Example #2
0
def display():
	output2d.draw_images()
	output2d.draw_inv_text()
	
	hallway_type = maze.current_type()

	GLComponents.hallway(hallway_type, True, maze.position.colours)
	pygame.display.flip()	#Refresh screen
		
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)	#Clear buffer
Example #3
0
def display_straight(delay, winning_spot):
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
	
	if winning_spot and maze.give_prize(inventory):	#Note the use of short circuit operators here. Be careful
		output2d.winning_message()
		#GLComponents.prize_picture(maze.position.prize[0]) #can add this for images I think??????not quite sure what it does, only seems to work sometimes (maybe its selecting nones sometimes)
	
	#GLComponents.prize_picture('food')
	output2d.draw_inv_text()  
	GLComponents.hallway(Hallways.STRAIGHT, True, MazeComponent.generate_colours(Hallways.STRAIGHT)) 

	pygame.display.flip() 
	time.mri_delay(delay)		#Show first hallway		
Example #4
0
def display_straight(delay, winning_spot):
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
	
	GLComponents.hallway(Hallways.STRAIGHT, True, MazeComponent.generate_colours(Hallways.STRAIGHT))

	if winning_spot and maze.give_prize(inventory):	#Note the use of short circuit operators here. Be careful
		output2d.winning_message()
		#GLComponents.prize_picture(maze.position.prize[0])
	
	#GLComponents.prize_picture('food')
	output2d.draw_inv_text()
	pygame.display.flip()
	time.mri_delay(delay)		#Show first hallway		
Example #5
0
def wait_key_up(key):
	
	if maze.give_prize(inventory):
			output2d.winning_message()
	
	GLComponents.hallway(maze.current_type(), True, maze.position.colours)							
	pygame.display.flip()
	
	
	while pygame.key.get_pressed()[key]:
		for event in pygame.event.get():
			if event.type == pygame.QUIT:	#Quit if you leave the window
				pygame.quit()
				quit()