本文整理汇总了Python中sprite.Sprite.get方法的典型用法代码示例。如果您正苦于以下问题:Python Sprite.get方法的具体用法?Python Sprite.get怎么用?Python Sprite.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sprite.Sprite
的用法示例。
在下文中一共展示了Sprite.get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def update(self):
if (self.disturbed):
self.sprite = Sprite.get('WATER_DISTURBED')
self.disturbed = False
return
self.has_fish = True if random.random() < .05 else False
if (self.has_fish):
self.sprite = Sprite.get('WATER_ACTIVE')
else:
self.sprite = Sprite.get('WATER')
示例2: pick
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def pick(self):
if (self.picked == False):
sprite = Sprite.get('GRASS')
self.picked = True
self.solid = False
self.sprite = sprite
return Wheat(0, 0)
else:
return None
示例3: chop
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def chop(self):
if (self.chopped == False):
sprite = Sprite.get('GRASS')
self.chopped = True
self.solid = False
self.sprite = sprite
return Log()
else:
return None
示例4: char_to_entity
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def char_to_entity(self, x, y, char):
sprite = None
solid = None
name = None
if (char == 'T'):
return Tree(x, y)
if (char == '.'):
sprite = Sprite.get('GRASS')
solid = False
name = 'grass'
if (char == 'c'):
sprite = Sprite.get('GRASS')
solid = False
name = 'grass'
self.entities.append(Chicken(x, y))
if (char == '~'):
return Water(x, y)
if (char == '"'):
return Wheat(x, y)
entity = Entity(x, y, name, sprite)
entity.solid = solid
return entity
示例5: grow
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def grow(self):
self.picked = False
self.ticks_since_picked = 0
self.solid = True
self.sprite = Sprite.get('WHEAT')
示例6: __init__
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def __init__(self, x, y):
sprite = Sprite.get('WHEAT')
super(Wheat, self).__init__(x, y, 'wheat', sprite)
self.picked = False
self.ticks_since_picked = 0
self.solid = False
示例7: __init__
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def __init__(self, x, y):
sprite = Sprite.get('CHICKEN')
super(Chicken, self).__init__(x, y, 'chicken', sprite)
self.owner = None
示例8: __init__
# 需要导入模块: from sprite import Sprite [as 别名]
# 或者: from sprite.Sprite import get [as 别名]
def __init__(self, x, y):
sprite = Sprite.get('PLAYER')
super(Player, self).__init__(x, y, 'player', sprite)
self.inventory.append(TinderBox())