本文整理汇总了Python中Player.useItem方法的典型用法代码示例。如果您正苦于以下问题:Python Player.useItem方法的具体用法?Python Player.useItem怎么用?Python Player.useItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.useItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: movement
# 需要导入模块: import Player [as 别名]
# 或者: from Player import useItem [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))
示例2: bananaNo
# 需要导入模块: import Player [as 别名]
# 或者: from Player import useItem [as 别名]
def bananaNo():
log.add_event("Comi la banana que encontre")
c = Item.create("comida")
inv.addItem(c)
removeItem(world, "banana")
Player.useItem(c, inv)