예제 #1
0
	def furball(self, mission, seed=0):
		globalvars.disable_menu = True #Disable the standard menu for now.
		rd.seed(seed) #Fix the seed for the random number generator.
		wipeOldScenario(); resetDust()
		globalvars.BGIMAGE = image_list['bggalaxies'].convert()
		#Make a few enemies near the player
		mindist = 200
		maxdist = 800
		#Make enemy units:
		points_to_win = 3 #Same as the number of enemies
		for _ in xrange(points_to_win):
			x,y = getCoordsNearLoc(globalvars.player.rect.center, mindist, maxdist, maxdist)
			enemy_ship = hudHelpers.getNewEnemy(x,y,'destroyer',2,2,2,2,2)
			hudHelpers.addNewEnemyToWorld(enemy_ship)
		#Make the score keeper:
		time_limit = 30 #time limit in seconds
		text = ['FURBALL COMPLETED']
		#Display timer and score count with the following:
		globalvars.score_keeper = displayUtilities.TimeLimitDisplay(text, \
			points_to_win=points_to_win, time_limit=time_limit, mission=mission)
		globalvars.intangibles_top.add(globalvars.score_keeper)
		#Draw the new background and flip the whole screen.
		globalvars.screen.blit(globalvars.BGIMAGE, (0,0))
		pygame.display.flip()
		#Display the intro to the mission
		globalvars.menu.setBasicTextPanel(['You have '+str(time_limit)+' seconds to defeat 3 enemies to win.'])
예제 #2
0
	def escort(self, mission, seed=0):
		globalvars.disable_menu = True #Disable the standard menu for now.
		rd.seed(seed) #Fix the seed for the random number generator.
		'''Escort (infinite space) - player must escort a friendly NPC ship to the destination'''
		wipeOldScenario(); resetDust()
		#Reset the player's location to 0,0 and his speed to zero
		globalvars.player.loc = (0.0, 0.0)
		globalvars.player.speed = 0.0
		globalvars.player.targetSpeed = 0.0
		finish_line = (6000, 0)
		#Protect this little dude on his way to the finish line.
		npc_friend = hudHelpers.getNewEnemy(25.0,25.0,'ship',2,2,0,0,0)
		npc_friend.setDestination(finish_line)
		npc_friend.state = ship.GOTO_STATE
		hudHelpers.addNewEnemyToWorld(npc_friend, add_to_team=globalvars.team_manager.player_team)
		#Display arrow to finish line
		globalvars.intangibles_top.add(displayUtilities.ArrowToDestination(npc_friend))
		#Display finish bullseye
		globalvars.intangibles_top.add(objInstances.FinishBullsEye(npc_friend, finish_line))
		#determine what sorts of obstacles to put on the race course.
		numbers = dict()
		numbers['enemy'] = 3
		numbers['crystal'] = 5
		numbers['large_asteroid'] = 20
		numbers['medium_asteroid'] = 30
		numbers['small_asteroid'] = 40
		numbers['gold_metal'] = 5
		numbers['silver_metal'] = 6
		numbers['health'] = 7
		numbers['capital_ship'] = 0
		#Populate space in a semi narrow corridor between the player and the finish line
		course_length = 6000 #pixels
		course_height = 1000 #pixels
		#Midway between player and destination
		midway = (course_length/2, 0)
		hudHelpers.populateSpace(objects=numbers, width=course_length, \
			height=course_height, center=midway, seed=rd.random())
		time_limit = 60 #time limit in seconds
		text = ['ESCORT MISSION COMPLETED']
		#Display timer and score count with the following:
		globalvars.score_keeper = displayUtilities.TimeLimitDisplay(text, \
			points_to_win=1000000, time_limit=time_limit, mission=mission)
		globalvars.intangibles_top.add(globalvars.score_keeper)
		#Draw the new background and flip the whole screen.
		globalvars.screen.fill(globalvars.BGCOLOR)
		pygame.display.flip()
		#Display the intro to the mission
		globalvars.menu.setBasicTextPanel(['You have '+str(time_limit)+' seconds to escort the friendly NPC to the finish.', 'If you lose your NPC ally, look for the yellow arrow.'])
예제 #3
0
	def epicBattle(self, mission, seed=0):
		globalvars.disable_menu = True #Disable the standard menu for now.
		rd.seed(seed) #Fix the seed for the random number generator.
		wipeOldScenario(); resetDust()
		globalvars.BGIMAGE = image_list['bggalaxies'].convert()
		spacing = 50
		n = 3
		#Make n+1 enemy units starting to the left of the player:
		start = (globalvars.player.rect.centerx-500, globalvars.player.rect.centery)
		for i in range(n+1):
			enemy_ship = hudHelpers.getNewEnemy(start[0],start[1]+spacing*i,\
				'destroyer',2,2,2,2,2)
			hudHelpers.addNewEnemyToWorld(enemy_ship)
		#Add an enemy capital ship
		enemy_ship = hudHelpers.getNewCapitalShip(start[0],start[1]+spacing*n)
		hudHelpers.addNewEnemyToWorld(enemy_ship)
		#Make n friendly units:
		start = (globalvars.player.rect.centerx+500, globalvars.player.rect.centery)
		add_to_blue = True
		for i in range(n):
			friendly_ship = hudHelpers.getNewEnemy(start[0],start[1]+spacing*i,\
				'ship',2,2,2,2,2)
			friendly_ship.theta = 179.0 #Face the ship to the left
			hudHelpers.addNewEnemyToWorld(friendly_ship,\
				add_to_team=globalvars.team_manager.player_team)
		#Add a friendly capital ship
		friendly_ship = hudHelpers.getNewCapitalShip(start[0],start[1]+spacing*n)
		hudHelpers.addNewEnemyToWorld(friendly_ship,\
			add_to_team=globalvars.team_manager.player_team)
		#Make the score keeper:
		time_limit = 120 #time limit in seconds
		text = ['BATTLE COMPLETED']
		#Display timer and score count with the following:
		globalvars.score_keeper = displayUtilities.TimeLimitDisplay(text, \
			points_to_win=103, time_limit=time_limit, mission=mission)
		globalvars.intangibles_top.add(globalvars.score_keeper)
		#Draw the new background and flip the whole screen.
		globalvars.screen.blit(globalvars.BGIMAGE, (0,0))
		pygame.display.flip()
		#Display the intro to the mission
		globalvars.menu.setBasicTextPanel(['You have '+str(time_limit)+' seconds to defeat the enemy team and prevent your team from being defeated.','Your team is to the right. The enemy team is to the left.'])