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


Python Matrix.setupAttackableZone方法代码示例

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


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

示例1: Client

# 需要导入模块: import Matrix [as 别名]
# 或者: from Matrix import setupAttackableZone [as 别名]

#.........这里部分代码省略.........
				self.matrix.sprites[charid].animation = 'walk'
			if stats['hp'] < (stats['hpmax']/2):
				self.matrix.sprites[charid].animation = 'weak'
			if stats['hp'] <= 0:
				self.matrix.sprites[charid].animation = 'dead'
				self.die_snd.play()
		h = self.camhandler.container.getH()
		self.matrix.sprites[charid].updateDisplayDir( h, True )
	
	def updateCursorPos(self, pos):
		
		self.camhandler.move(self.battleGraphics.logic2terrain(pos))
		
		(x, y, z) = pos
		tile = self.party['map']['tiles'][x][y][z]
		
		self.cursor.move(x, y, z, tile)
		
		if self.charbars:
			self.charbars.hide()
		
		if self.party['map']['tiles'][x][y][z].has_key('char'):
			charid = self.party['map']['tiles'][x][y][z]['char']
			char = self.party['chars'][charid]
			if self.subphase == 'attack':
				self.charbars = GUI.CharBarsRight(char)
			else:
				self.charbars = GUI.CharBarsLeft(char)
		
		try:
			self.coords.update(tile)
		except:
			self.coords = GUI.Coords(tile)
	
### Events
	
	# Battle func
	def setupWalkableTileChooser(self, charid, walkables):
		self.inputs.acceptAll()
		self.camhandler.acceptAll()
		self.subphase = 'move'
		self.matrix.setupWalkableZone(charid, walkables)
		if self.charcard:
			self.charcard.hide()
	
	# Battle func
	def setupAttackableTileChooser(self, charid, attackables):
		self.inputs.acceptAll()
		self.camhandler.acceptAll()
		self.subphase = 'attack'
		self.matrix.setupAttackableZone(charid, attackables)
		if self.charcard:
			self.charcard.hide()
	
	# Battle func
	def setupDirectionChooser(self, charid):
		self.inputs.ignoreAll()
		self.camhandler.acceptAll()
		self.at.hide()
		DirectionChooser(charid, self.matrix.sprites[charid], self.camhandler, self.send.WAIT, self.send.UPDATE_PARTY)
	
	# Attack button clicked
	def onAttackClicked(self, charid):
		self.inputs.ignoreAll()
		self.camhandler.ignoreAll()
		GUI.Help(
			0, 25, 155, 44,
			'shadowed', 'Check',
			'Specify the target with the cursor.\nPress the %c button to select.' % CIRCLE_BTN.upper(),
			lambda: self.send.GET_ATTACKABLES(charid),
			self.send.UPDATE_PARTY,
		)
	
	# Wait menu item chosen
	def onWaitClicked(self, charid):
		self.inputs.ignoreAll()
		self.camhandler.ignoreAll()
		GUI.Help(
			0, 25, 135, 60,
			'shadowed', 'Check',
			'Specify the direction with\nthe Directional buttons.\nPress the %c button to select.' % CIRCLE_BTN.upper(),
			lambda: self.setupDirectionChooser(charid),
			self.send.UPDATE_PARTY,
		)
	
	# Cancel menu item chosen
	def onCancelClicked(self, charid):
		self.inputs.acceptAll()
		self.camhandler.acceptAll()
		if self.charcard:
			self.charcard.hide()
	
	### Tasks
	
	# Updates the displayed direction of a character according to the camera angle
	def characterDirectionTask(self, task):
		h = self.camhandler.container.getH()
		for charid in self.matrix.sprites:
			self.matrix.sprites[charid].updateDisplayDir( h );
		return Task.cont
开发者ID:,项目名称:,代码行数:104,代码来源:


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