How to use the flax.entity.Sprite 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 / entity.py View on Github external
Render(sprite=Sprite.ladder, color='wood'),
    name='ladder',
)
CaveWall = Architecture(
    Solid,
    Render(sprite=Sprite.halftone, color='rock'),
    name='wall',
)
Wall = Architecture(
    Solid,
    Render(sprite=Sprite.fill, color='wall'),
    name='wall',
)
Pillar = Architecture(
    Solid,
    Render(sprite=Sprite.pillar, color='rock'),
    name='pillar',
)
KadathGate = Architecture(
    Solid,
    Render(sprite=Sprite.gate, color='gate'),
    name='wall',
)
Water = Architecture(
    Solid,
    Render(sprite=Sprite.water, color='water'),
    name='water',
)
Bridge = Architecture(
    Empty,
    Render(sprite=Sprite.bridge, color='bridge'),
    name='bridge',
github eevee / flax / flax / entity.py View on Github external
Breakable(health=10),
    HealthRender(
        (2, Sprite.rubble4, 'decay2'),
        (2, Sprite.rubble3, 'decay2'),
        (2, Sprite.rubble2, 'decay2'),
        (2, Sprite.rubble1, 'decay3'),
    ),
    name='rubble',
)

Ruin = Architecture(
    Solid,
    Breakable(health=10),
    HealthRender(
        (1, Sprite.ruin4a, 'decay3'),
        (1, Sprite.ruin4b, 'decay3'),
        (1, Sprite.ruin4c, 'decay3'),
        (1, Sprite.ruin4d, 'decay3'),
        (5, Sprite.ruin3a, 'decay2'),
        (5, Sprite.ruin3b, 'decay2'),
        (3, Sprite.ruin2, 'decay1'),
        (10, Sprite.ruin1e, 'decay0'),
    ),
    name='ruin',
)


# -----------------------------------------------------------------------------
# Creatures

Creature = partial(EntityType, Solid, Container, Bodied, layer=Layer.creature)
Player = Creature(
github eevee / flax / flax / entity.py View on Github external
name='freshly-cut grass',
)
Dirt = Architecture(
    Empty,
    Render(sprite=Sprite.speckle, color='dirt'),
    name='dirt',
)
CaveFloor = Architecture(
    Empty,
    Render(sprite=Sprite.floor, color='dirt'),
    name='cave floor',
)

Door = Architecture(
    DoorPhysics,
    OpenRender(locked=(Sprite.door_locked, 'dirt'), open=(Sprite.door_open, 'dirt'), closed=(Sprite.door_closed, 'dirt')),
    Openable,
    Lockable,
    name='door',
)

from flax.component import Breakable, HealthRender
Rubble = Architecture(
    Empty,
    Breakable(health=10),
    HealthRender(
        (2, Sprite.rubble4, 'decay2'),
        (2, Sprite.rubble3, 'decay2'),
        (2, Sprite.rubble2, 'decay2'),
        (2, Sprite.rubble1, 'decay3'),
    ),
    name='rubble',
github eevee / flax / flax / entity.py View on Github external
Render(sprite=Sprite.halftone, color='rock'),
    name='wall',
)
Wall = Architecture(
    Solid,
    Render(sprite=Sprite.fill, color='wall'),
    name='wall',
)
Pillar = Architecture(
    Solid,
    Render(sprite=Sprite.pillar, color='rock'),
    name='pillar',
)
KadathGate = Architecture(
    Solid,
    Render(sprite=Sprite.gate, color='gate'),
    name='wall',
)
Water = Architecture(
    Solid,
    Render(sprite=Sprite.water, color='water'),
    name='water',
)
Bridge = Architecture(
    Empty,
    Render(sprite=Sprite.bridge, color='bridge'),
    name='bridge',
)
Floor = Architecture(
    Empty,
    Render(sprite=Sprite.floor, color='floor'),
    name='dirt',
github eevee / flax / flax / entity.py View on Github external
HealthRender(
        (2, Sprite.rubble4, 'decay2'),
        (2, Sprite.rubble3, 'decay2'),
        (2, Sprite.rubble2, 'decay2'),
        (2, Sprite.rubble1, 'decay3'),
    ),
    name='rubble',
)

Ruin = Architecture(
    Solid,
    Breakable(health=10),
    HealthRender(
        (1, Sprite.ruin4a, 'decay3'),
        (1, Sprite.ruin4b, 'decay3'),
        (1, Sprite.ruin4c, 'decay3'),
        (1, Sprite.ruin4d, 'decay3'),
        (5, Sprite.ruin3a, 'decay2'),
        (5, Sprite.ruin3b, 'decay2'),
        (3, Sprite.ruin2, 'decay1'),
        (10, Sprite.ruin1e, 'decay0'),
    ),
    name='ruin',
)


# -----------------------------------------------------------------------------
# Creatures

Creature = partial(EntityType, Solid, Container, Bodied, layer=Layer.creature)
Player = Creature(
    Combatant(strength=3, health=20),
github eevee / flax / flax / entity.py View on Github external
Render(sprite=Sprite.bridge, color='bridge'),
    name='bridge',
)
Floor = Architecture(
    Empty,
    Render(sprite=Sprite.floor, color='floor'),
    name='dirt',
)
Tree = Architecture(
    Solid,
    Render(sprite=Sprite.tree, color='tree'),
    name='tree',
)
Grass = Architecture(
    Empty,
    Render(sprite=Sprite.tall_grass, color='grass'),
    name='grass',
)
CutGrass = Architecture(
    Empty,
    Render(sprite=Sprite.grass, color='grass'),
    name='freshly-cut grass',
)
Dirt = Architecture(
    Empty,
    Render(sprite=Sprite.speckle, color='dirt'),
    name='dirt',
)
CaveFloor = Architecture(
    Empty,
    Render(sprite=Sprite.floor, color='dirt'),
    name='cave floor',
github eevee / flax / flax / entity.py View on Github external
Door = Architecture(
    DoorPhysics,
    OpenRender(locked=(Sprite.door_locked, 'dirt'), open=(Sprite.door_open, 'dirt'), closed=(Sprite.door_closed, 'dirt')),
    Openable,
    Lockable,
    name='door',
)

from flax.component import Breakable, HealthRender
Rubble = Architecture(
    Empty,
    Breakable(health=10),
    HealthRender(
        (2, Sprite.rubble4, 'decay2'),
        (2, Sprite.rubble3, 'decay2'),
        (2, Sprite.rubble2, 'decay2'),
        (2, Sprite.rubble1, 'decay3'),
    ),
    name='rubble',
)

Ruin = Architecture(
    Solid,
    Breakable(health=10),
    HealthRender(
        (1, Sprite.ruin4a, 'decay3'),
        (1, Sprite.ruin4b, 'decay3'),
        (1, Sprite.ruin4c, 'decay3'),
        (1, Sprite.ruin4d, 'decay3'),
        (5, Sprite.ruin3a, 'decay2'),
        (5, Sprite.ruin3b, 'decay2'),
github eevee / flax / flax / entity.py View on Github external
Render(sprite=Sprite.tree, color='tree'),
    name='tree',
)
Grass = Architecture(
    Empty,
    Render(sprite=Sprite.tall_grass, color='grass'),
    name='grass',
)
CutGrass = Architecture(
    Empty,
    Render(sprite=Sprite.grass, color='grass'),
    name='freshly-cut grass',
)
Dirt = Architecture(
    Empty,
    Render(sprite=Sprite.speckle, color='dirt'),
    name='dirt',
)
CaveFloor = Architecture(
    Empty,
    Render(sprite=Sprite.floor, color='dirt'),
    name='cave floor',
)

Door = Architecture(
    DoorPhysics,
    OpenRender(locked=(Sprite.door_locked, 'dirt'), open=(Sprite.door_open, 'dirt'), closed=(Sprite.door_closed, 'dirt')),
    Openable,
    Lockable,
    name='door',
)
github eevee / flax / flax / entity.py View on Github external
(2, Sprite.rubble3, 'decay2'),
        (2, Sprite.rubble2, 'decay2'),
        (2, Sprite.rubble1, 'decay3'),
    ),
    name='rubble',
)

Ruin = Architecture(
    Solid,
    Breakable(health=10),
    HealthRender(
        (1, Sprite.ruin4a, 'decay3'),
        (1, Sprite.ruin4b, 'decay3'),
        (1, Sprite.ruin4c, 'decay3'),
        (1, Sprite.ruin4d, 'decay3'),
        (5, Sprite.ruin3a, 'decay2'),
        (5, Sprite.ruin3b, 'decay2'),
        (3, Sprite.ruin2, 'decay1'),
        (10, Sprite.ruin1e, 'decay0'),
    ),
    name='ruin',
)


# -----------------------------------------------------------------------------
# Creatures

Creature = partial(EntityType, Solid, Container, Bodied, layer=Layer.creature)
Player = Creature(
    Combatant(strength=3, health=20),
    PlayerIntelligence,
    Render(sprite=Sprite.player, color='player'),