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


Python Player.getPlayPos方法代码示例

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


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

示例1: movement

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getPlayPos [as 别名]
	def movement(self, ginput):
		px = Player.getPlayPos()[0]
		py = Player.getPlayPos()[1]

		left = self.world.grid[px - 1][py]
		right = self.world.grid[px + 1][py]
		up = self.world.grid[px][py - 1]
		down = self.world.grid[px][py + 1]

		def check(key):
			if not ((key != '#' and key != 'T' and key != 'Y' and key != '~') or debug.debug):
				self.hit_sound.play()
				return False
			return True

		if ginput == 'left' and check(left):
			Player.getPlayPos()[0] -= 1
		elif ginput == 'right' and check(right):
			Player.getPlayPos()[0] += 1
		elif ginput == 'up' and check(up):
			Player.getPlayPos()[1] -= 1
		elif ginput == 'down' and check(down):
			Player.getPlayPos()[1] += 1
		elif ginput == 'it_1':
			if not self.inventory.getItem(1) is None:
				self.log.add_event(Player.useItem(self.inventory.getItem(1), self.inventory))
		elif ginput == 'it_2':
			if not self.inventory.getItem(2) is None:
				self.log.add_event(Player.useItem(self.inventory.getItem(2), self.inventory))
		elif ginput == 'it_3':
			if not self.inventory.getItem(3) is None:
				self.log.add_event(Player.useItem(self.inventory.getItem(3), self.inventory))
开发者ID:vgdev-beauchef,项目名称:Wilson,代码行数:34,代码来源:Controller.py

示例2: manage_place

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getPlayPos [as 别名]
	def manage_place(self):
		px = Player.getPlayPos()[0]
		py = Player.getPlayPos()[1]

		pos = self.world.grid[px][py]
		option = ""
		yes_answer = ""
		no_aswer = ""
		flag = False
开发者ID:vgdev-beauchef,项目名称:Wilson,代码行数:11,代码来源:Controller.py

示例3: movement

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getPlayPos [as 别名]
 def movement(self, ginput):
     px = Player.getPlayPos()[0]
     py = Player.getPlayPos()[1]
     if ginput == "left" and (self.world.grid[px - 1][py] != "#" or debug.debug):
         Player.getPlayPos()[0] -= 1
     elif ginput == "right" and (self.world.grid[px + 1][py] != "#" or debug.debug):
         Player.getPlayPos()[0] += 1
     elif ginput == "up" and (self.world.grid[px][py - 1] != "#" or debug.debug):
         Player.getPlayPos()[1] -= 1
     elif ginput == "down" and (self.world.grid[px][py + 1] != "#" or debug.debug):
         Player.getPlayPos()[1] += 1
开发者ID:PaperTanuki,项目名称:Delve,代码行数:13,代码来源:UI.py

示例4: removeItem

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getPlayPos [as 别名]
def removeItem(world, itemName):
    px = Player.getPlayPos()[0]
    py = Player.getPlayPos()[1]
    replacement = Item.getReplacement(itemName, px, py)
    world.grid[px][py] = replacement
开发者ID:vgdev-beauchef,项目名称:Wilson,代码行数:7,代码来源:Events.py

示例5: manage

# 需要导入模块: import Player [as 别名]
# 或者: from Player import getPlayPos [as 别名]
	def manage(self, ginput):
		pxi = Player.getPlayPos()[0]
		pyi = Player.getPlayPos()[1]

		self.movement(ginput)
		self.manage_place()
		self.manage_log(ginput)

		pxf = Player.getPlayPos()[0]
		pyf = Player.getPlayPos()[1]

		if self.escape:
			return

		if self.key_map.is_visible():
			#TODO
			if ginput == 'map':
				self.key_map.visibility(False)
			return

		if ginput == 'map':
			#TODO
			self.key_map.visibility(True)
			return

		if (ginput=='left' or ginput=='right' or ginput=='up' or ginput=='down') and (pxi!=pxf or pyi!=pyf) and not debug.debug:
			self.dayCount+=1
			self.stepCount+=1
			if self.dayCount < self.dayCountLimit/3:
				world._viewRadius = 13
			elif self.dayCount < self.dayCountLimit*2/3:
				world._viewRadius = 10
			else:
				world._viewRadius = 7
			if self.dayCount < self.dayCountLimit*2/3:
				world.tiles['rock']      = world.colors['gray']
				world.tiles['sand']      = world.colors['sand']
				world.tiles['deep']      = world.colors['deep-blue']
				world.tiles['grass']     = world.colors['grass']
				world.tiles['obj']       = world.colors['fucsia']
				world.tiles['cave']      = world.colors['dark']
				world.tiles['shallow']   = world.colors['shallow-blue']
				world.tiles['palm']      = world.colors['palm']
				world.tiles['tree']      = world.colors['tree']
			else:
				world.tiles['rock']      = world.colors['gray-night']
				world.tiles['sand']      = world.colors['sand-night']
				world.tiles['deep']      = world.colors['deep-blue-night']
				world.tiles['grass']     = world.colors['grass-night']
				world.tiles['obj']       = world.colors['fucsia-night']
				world.tiles['cave']      = world.colors['dark-night']
				world.tiles['shallow']   = world.colors['shallow-blue-night']
				world.tiles['palm']      = world.colors['palm-night']
				world.tiles['tree']      = world.colors['tree-night']
			#self.log.add_event(ginput)
			self.info.setTime(self.dayCount)
			if(self.stepCount%2==0):
				Player.modifyHunger(-1)

			if self.dayCount>self.dayCountLimit:
				self.dayCount=0
				self.log.increase_day()

			self.linearState.changeState(self.stepCount, self.log)
			self.storyState.computeStoryState(self.dayCount, self.stepCount, pxf, pyf)
			self.eventsState.checkIndividualStates(self.dayCount, self.stepCount, pxf, pyf, self.events.getCurrentList())

		if (ginput=='left' or ginput=='right' or ginput=='up' or ginput=='down') and (pxi!=pxf or pyi!=pyf) and debug.debug:
			self.info.setPos(pxf, pyf)

		self.showHungerMessages()
		self.resetHungerFlags()
开发者ID:vgdev-beauchef,项目名称:Wilson,代码行数:74,代码来源:Controller.py


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