diff options
| author | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-09-14 22:33:35 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth@simponic.xyz> | 2024-09-14 22:33:35 -0700 |
| commit | f7e7121fce7bd3f7fdabe836955e43b3d194c1c6 (patch) | |
| tree | 7092421f8a594f62164192d27df69220edda223c /kennel/engine/entities/cat.py | |
| parent | 8ec7f5368232d59f344e1067e1bad5e48dbcb7ae (diff) | |
| download | kennel.hatecomputers.club-f7e7121fce7bd3f7fdabe836955e43b3d194c1c6.tar.gz kennel.hatecomputers.club-f7e7121fce7bd3f7fdabe836955e43b3d194c1c6.zip | |
add a spritesheet component
Diffstat (limited to 'kennel/engine/entities/cat.py')
| -rw-r--r-- | kennel/engine/entities/cat.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/kennel/engine/entities/cat.py b/kennel/engine/entities/cat.py index edcde37..b5a8c6c 100644 --- a/kennel/engine/entities/cat.py +++ b/kennel/engine/entities/cat.py @@ -1,14 +1,33 @@ from kennel.engine.components.position import Position - +from kennel.engine.components.sprite_sheet import SpriteSheet, SpriteSpec +from enum import Enum from .entity import Entity, EntityType +class CatState(Enum): + IDLE = "IDLE" + FROLICKING = "FROLICKING" + EEPY = "EEPY" + ALERT = "ALERT" + CHASING_CURSOR = "CHASING_CURSOR" + CHASING_CAT = "CHASING_CAT" + SCRATCHING = "SCRATCHING" + ITCHY = "ITCHY" + + class Cat(Entity): - def __init__(self, id: str): - components = [Position(0, 0)] + def __init__(self, id: str, spritesheet_source: str): + state_to_spritespec = self.get_state_to_spritespec() + components = [ + Position(0, 0), + SpriteSheet(spritesheet_source, state_to_spritespec, CatState.ALERT), + ] super().__init__(EntityType.CAT, id, components) + def get_state_to_spritespec(self): + return {CatState.ALERT: SpriteSpec(100, 0, 0, 200, 40, 5)} + # # # IDLE, FROLICKING, EEPY, ALERT, CHASING_CURSOR, CHASING_CAT, SCRATCHING, ITCHY @@ -32,14 +51,6 @@ class Cat(Entity): # ] # # -# class CatState(Enum): -# IDLE = 0 -# FROLICKING = 1 -# EEPY = 2 -# ALERT = 3 -# CHASING_CURSOR = 4 -# CHASING_CAT = 5 -# SCRATCHING = 6 -# ITCHY = 7 + # # |
