本文整理汇总了Python中Character.Character.get_health方法的典型用法代码示例。如果您正苦于以下问题:Python Character.get_health方法的具体用法?Python Character.get_health怎么用?Python Character.get_health使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Character.Character
的用法示例。
在下文中一共展示了Character.get_health方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: take_damage
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_health [as 别名]
def take_damage(self, health_change):
health = Character.get_health(self)
if health <= health_change and not self._is_dead:
Character.set_health(self, 0)
self.hb.setValue(0)
hurt_interval = self._character.actorInterval("hurt")
death_interval = self._character.actorInterval("die")
seq = Sequence(hurt_interval, death_interval)
seq.start()
self._is_dead = True
else:
Character.set_health(self, health-health_change)
self.hb.setValue(Character.get_health(self)-health_change)
self._character.play("hurt")
示例2: apply_def_buff
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_health [as 别名]
def apply_def_buff(self):
if not self._is_dead:
health = Character.get_health(self)
if self._def_buff==1:
Character.set_health(self, health*1.1)
Swordsman.MAX_HEALTH = Swordsman.MAX_HEALTH*1.1
elif self._def_buff==2:
Character.set_health(self, health*1.25)
Swordsman.MAX_HEALTH = Swordsman.MAX_HEALTH*1.25
示例3: unapply_def_buff
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_health [as 别名]
def unapply_def_buff(self):
if not self._is_dead:
if self._def_buff==0:
Swordsman.MAX_HEALTH = 100
elif Swordsman.MAX_HEALTH==125 and self._def_buff==1:
Swordsman.MAX_HEALTH = 110
health = Character.get_health(self)
if health > Swordsman.MAX_HEALTH:
health = Swordsman.MAX_HEALTH
示例4: take_damage
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_health [as 别名]
def take_damage(self, health_change):
health = Character.get_health(self)
if health < health_change and not self._is_dead:
Character.set_health(self, 0)
self.hb.setValue(0)
hurt_interval = self._character.actorInterval("hurt")
death_interval = self._character.actorInterval("die")
seq = Sequence(hurt_interval, death_interval)
seq.append(Wait(2))
# add Func interval to place the character at a new location
seq.append(Func(self.respawn))
seq.start()
self._is_dead = True
#self._is_moving=2
else:
Character.set_health(self, health-health_change)
#self.hb.setValue(Character.get_health(self)-health_change)
self.hb.setValue(Character.get_health(self))
self._character.play("hurt")
示例5: unapply_def_buff
# 需要导入模块: from Character import Character [as 别名]
# 或者: from Character.Character import get_health [as 别名]
def unapply_def_buff(self):
if not self._is_dead:
if self._def_buff==0:
Axeman.MAX_HEALTH = 100
elif Axeman.MAX_HEALTH==140 and self._def_buff==1:
Axeman.MAX_HEALTH = 110
health = Character.get_health(self)
if health > Axeman.MAX_HEALTH:
health = Axeman.MAX_HEALTH
pass