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


Python Matrix.getCharacterCoords方法代码示例

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


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

示例1: Client

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

#.........这里部分代码省略.........
		
		columns = [ { 'x': -25, 'font': GUI.regularfont, 'align': TextNode.ALeft   }, ]
		
		rows = [
			{ 'cells': ['Move'        ], 'enabled': canmove, 'callback': lambda: self.send.GET_WALKABLES  (charid) },
			{ 'cells': ['Act'         ], 'enabled': canact , 'callback': lambda: self.onAttackClicked(charid) },
			{ 'cells': ['Wait'        ], 'enabled': True   , 'callback': lambda: self.onWaitClicked  (charid) },
			{ 'cells': ['Status'      ], 'enabled': False  , 'callback': lambda: self.onWaitClicked  (charid) },
			{ 'cells': ['Auto-Battle' ], 'enabled': False  , 'callback': lambda: self.onWaitClicked  (charid) },
		]
		
		GUI.ScrollableList(
			'shadowed', 73, -8, 62.0, 91.0, 16, 
			columns, rows, 5, 
			lambda: self.onCancelClicked(charid), 
			'Menu'
		)
	
	def moveCheck(self, charid, orig, origdir, dest):
		self.inputs.ignoreAll()
		self.camhandler.ignoreAll()
		GUI.MoveCheck(
			lambda: self.send.MOVE_TO(charid, dest),
			lambda: self.cancelMove(charid, orig, origdir)
		)
	
	def cancelMove(self, charid, orig, origdir):
		self.matrix.sprites[charid].node.setPos(self.battleGraphics.logic2terrain(orig))
		self.matrix.sprites[charid].setRealDir(origdir)
		self.send.UPDATE_PARTY()
	
	# Makes a character look at another one
	def characterLookAt(self, charid, targetid):
		(x1, y1, z1) = self.matrix.getCharacterCoords(charid)
		(x2, y2, z2) = self.matrix.getCharacterCoords(targetid)
		if x1 > x2:
			self.matrix.sprites[charid].setRealDir(3)
		if x1 < x2:
			self.matrix.sprites[charid].setRealDir(1)
		if y1 > y2:
			self.matrix.sprites[charid].setRealDir(4)
		if y1 < y2:
			self.matrix.sprites[charid].setRealDir(2)
	
	# Update the status (animation) of a sprite after something happened
	def updateSpriteAnimation(self, charid, animation=False):
		if animation:
			self.matrix.sprites[charid].animation = animation
		else:
			stats = self.party['chars'][charid]
			if stats['hp'] >= (stats['hpmax']/2):
				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]
开发者ID:,项目名称:,代码行数:70,代码来源:


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