当前位置: 首页>>代码示例>>Python>>正文


Python Enemy.tile_y方法代码示例

本文整理汇总了Python中enemy.Enemy.tile_y方法的典型用法代码示例。如果您正苦于以下问题:Python Enemy.tile_y方法的具体用法?Python Enemy.tile_y怎么用?Python Enemy.tile_y使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在enemy.Enemy的用法示例。


在下文中一共展示了Enemy.tile_y方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_wave

# 需要导入模块: from enemy import Enemy [as 别名]
# 或者: from enemy.Enemy import tile_y [as 别名]
	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
开发者ID:Tother89,项目名称:Tower-Defense-Game,代码行数:26,代码来源:gui.py


注:本文中的enemy.Enemy.tile_y方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。