Esempio n. 1
0
def shipProfile(ship, profile='default'):
	#Give enemy a random weapon
	temp = weapon.generateWeapon(rd.randint(0, len(weapon.weapon_class_names)-1))
	temp.shooter = ship
	ship.gun = temp
	#Give enemy an engine
	ship.engine = engine.Engine()
	engine.setProfile('mk1', ship.engine)
Esempio n. 2
0
	def __init__(self, centerx=0, centery=0, image_name='default'):
		#Capital ship uses custom collision dimensions
		#Original dimensions: 990 x 280
		#collisiontopleft is the inset.
		#collisionwidth and collisionheight are the width and height from the inset.
		physicalObject.PhysicalObject.__init__(self, centerx=centerx,\
			centery=centery, image_name=image_name,\
			collisiontopleft=(100,120), collisionwidth=890,  collisionheight=140)

		self.team = globalvars.team_manager.default_enemy_team
		self.weapons=[]
		#Load some weapons on the capital ship
		#Initially 3 basic lasers
		self.weapons = []
		for _ in range(3):
			temp = weapon.generateWeapon(2)
			temp.shooter = self
			self.weapons.append(temp)
		#Gun locations for the capital ship
		self.myTop = self.rect.topleft[1]+self.collisiontopleft[1]
		self.myLeft = self.rect.topleft[0]+self.collisiontopleft[0]
		self.myBottom = self.rect.topleft[1]+self.collisiontopleft[1]+self.collisionheight
		self.gunlocs = [(self.rect.centerx, self.myTop), #top
			(self.myLeft, self.rect.centery), #left
			(self.rect.centerx, self.myBottom)] #bottom
		#Set the weapon offsets
		self.weapons[0].offset = (0, self.collisionheight/-2) #top
		self.weapons[1].offset = (self.collisionwidth/-2, 0) #left
		self.weapons[2].offset = (0, self.collisionheight/2) #bottom

		self.targets = [None for _ in range(len(self.gunlocs))]
		
		self.engine=None

		self.health=500
		self.maxhealth=500

		self.is_a = globalvars.CAPITALSHIP
		self.isPlayer = False

		#Use rectangular (as opposed to circular) collision detection.
		self.useRectangular = True

		self.thorns_damage = 5
		self.breaker_damage = 10000

		#Seconds to wait before resetting targets
		self.target_update_wait = 1.0 * globalvars.FPS
		self.target_update_count = 0