Exemple #1
0
	def run_game(self):
		master_screen = pygame.display.set_mode(DISPLAY, FLAGS, DEPTH)
		pygame.display.set_caption("RM RPG")
		timer = pygame.time.Clock()

		#TEMP
		world = World()
		player = Player(world)
		world.add_player(player, 35, 20)
		#TEMP

		game_controls = WorldControls(player) # TODO: specify what kind of controls should be used at the start of the game and use a different constructor.
		control_manager = ControlManager(game_controls)
		main_screen = WorldScreen(control_manager, player) #TODO: specify type of screen
		screen_manager = ScreenManager(master_screen, main_screen, player)

		world.initialize_screen(screen_manager, main_screen)

		while 1:
			timer.tick(FRAMES) # make this value lower to make the game run slowly for testing. (use about 40-50 I think)
 			for e in pygame.event.get():
				screen_manager.process_event(e)
			screen_manager.update_current_screen()
			self.draw_screen(screen_manager)
			pygame.display.update()
			"""
			timer.tick(100)
			for e in pygame.event.get():
				if e.type == QUIT: raise SystemExit, "QUIT"
			screen.blit(player.image, (0, 0))
			pygame.display.update()
			"""
		"""GM.runGame (...) -> None

		Run the game using a pygame screen.

		Attributes:
		master_screen: the pygame screen onto which everything will be displayed
		during the game.
		"""

		"""
		start_dungeon, dungeon_name, master_screen = self.build_dungeon_and_screen() 
		world = World(start_dungeon) # TODO: implement world (contains all dungeons, along with other global data-- how to do this?)
		"""
		"""