How to use the flax.component.ICombatant function in flax

To help you get started, we’ve selected a few flax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eevee / flax / flax / component.py View on Github external
def current_rendering(self):
        health = (
            ICombatant(self.entity).current_health /
            ICombatant(self.entity).maximum_health)
        for weight, sprite, color in self.choices:
            if health <= weight:
                return sprite, color
            health -= weight
github eevee / flax / flax / ui / console / game.py View on Github external
def update(self):
        from flax.component import ICombatant
        combatant = ICombatant(self.player)
        #self.health_text.set_text("Health: {}".format(ICombatant(self.player).health))
        self.health_meter.current = combatant.current_health
        self.health_meter.maximum = combatant.maximum_health
        self.strength_text.set_text("Strength: {}".format(combatant.strength))
        self._invalidate()
github eevee / flax / flax / component.py View on Github external
def current_rendering(self):
        health = (
            ICombatant(self.entity).current_health /
            ICombatant(self.entity).maximum_health)
        for weight, sprite, color in self.choices:
            if health <= weight:
                return sprite, color
            health -= weight
github eevee / flax / flax / component.py View on Github external
def do_melee_attack(event, combatant):
    opponent = ICombatant(event.actor)
    event.world.queue_immediate_event(
        Damage(combatant.entity, opponent.strength))