Example #1
0
	def setup_wave(self):
		'''
		Setups the wave of enemies about to be released
		'''
		starting_x = 3 # starting x of sprite
		starting_y = 2 # end x of sprite
		unit_angle = 0 # set angle to 0
		self.mode = Modes.wave # switch mode to sending wave, cannot use other functions in this mode
		# Increase wave multiplier by 5 each new wave
		# wave_amount += 5
		# create new unit at beginning of path
		new_unit = Enemy(tile_x = starting_x,tile_y = starting_y,activate = True,angle = unit_angle,add_health = 2*self.wave)
		for i in range(len(self.path_list)): # for path list
			select = self.find_path((new_unit.tile_x, new_unit.tile_y)) # find next tile in path
			new_unit.tile_x = select[0] # x pos of next tile
			new_unit.tile_y = select[1] # y pos of next tile
			if select == (0,0): # if receive (0,0) means sprite reached end
				new_unit.deactivate() # deactivate the sprite
				self.health -= 1 # subtract 1 from health for reaching nexus/end of path
			self.update() # run update group
			self.draw() # run draw function
			time.sleep(0.05) # delay for movement
		self.wave += 1 # increase wave counter
		self.mode = Modes.select # switch mode back to select