Ejemplo n.º 1
0
def main():
	#pygame init
	pygame.mixer.pre_init(SAMPLE_RATE, BIT, CHANNELS, BUFFER_SIZE)
	pygame.init()
	pygame.display.set_mode((WIDTH, HEIGHT))
	pygame.display.set_caption('PyTone')

	#make background
	background = Gradient((WIDTH, HEIGHT), GRAD_START, GRAD_END)

	#path to medias
	path = 'media/'

	pygame.display.set_icon(pygame.image.load(path + 'petrol.png'))

	#intro duration in milliseconds
	duration = 4000

	#states
	intro = Intro(background, path, duration)
	menu = Menu(background, path)
	game = Game(background, path)
	instructions = Instructions(background, path)

	intro.run()

	#storing return value from menu
	running = True
	while running:
		option = menu.run()
		if option == NEW_GAME:
			option = game.run()

		elif option == INSTRUCTIONS:
			instructions.run()
		elif option == PRACTICE:
			#intro.run()
			game.set_practise(True)
			game.run()
			game.set_practise(False)

		#no elif here to make different states be able to quit as well
		if option == pygame.locals.QUIT:
			pygame.quit()
			running = False
Ejemplo n.º 2
0
def instructionsGame():
    screen_dimensions = utils.get_screen_dimensions()
    instructions = Instructions(screen_dimensions['width'],
                                screen_dimensions['height'])
    instructions.run(True)