本文整理汇总了Python中inventory.Inventory.canget方法的典型用法代码示例。如果您正苦于以下问题:Python Inventory.canget方法的具体用法?Python Inventory.canget怎么用?Python Inventory.canget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.canget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: touch
# 需要导入模块: from inventory import Inventory [as 别名]
# 或者: from inventory.Inventory import canget [as 别名]
def touch(self, e):
if self.imortal == 0:
self.g.hurt.play()
self.imortal = 10
self.health -= e.get_damage()
ef = Effect(self.g, "health", (self.rect.x, self.rect.y))
ef.healthchange = -e.get_damage()
# drop some skyberries
if "weapon" in self.g.saveData:
if self.g.saveData["weapon"] >= 1:
wpnstr = "shot" + str(self.g.saveData["weapon"]) + "_lvl"
if self.g.saveData[wpnstr] > 1:
self.g.saveData[wpnstr] -= 1
if self.g.saveData[wpnstr] == 9:
Effect(self.g, "msg", (self.rect.x, self.rect.y), "Level Down")
if self.g.saveData[wpnstr] == 19:
Effect(self.g, "msg", (self.rect.x, self.rect.y), "Level Down")
sb = Inventory(self.g, "skyberry", (self.rect.x, self.rect.y))
sb.canget = 0
sb = Inventory(self.g, "skyberry", (self.rect.x, self.rect.y))
sb.canget = 0
sb = Inventory(self.g, "skyberry", (self.rect.x, self.rect.y))
sb.canget = 0
self.g.player.gravity = 15
self.g.player.jumping = 1
if self.g.saveData["weapon"] != 0:
shotType = "shot" + str(self.g.saveData["weapon"])
self.g.saveData[shotType] -= 1
self.g.saveData["health"] = self.health