diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-06-25 22:44:23 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-06-25 22:44:23 +0100 |
commit | 6bd6757583510ba3edf75451309e4b8ec8c9b0f1 (patch) | |
tree | e63f401238e4118ff6d1670ea86508f0181c19ea /src/entities.h | |
parent | 2d7fbc07acf0c5766d662d2629e72600b65f744b (diff) | |
download | gold-mine-run-6bd6757583510ba3edf75451309e4b8ec8c9b0f1.tar.gz gold-mine-run-6bd6757583510ba3edf75451309e4b8ec8c9b0f1.zip |
Add entity system, add new enemy (snake)
Diffstat (limited to 'src/entities.h')
-rw-r--r-- | src/entities.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/entities.h b/src/entities.h new file mode 100644 index 0000000..e553390 --- /dev/null +++ b/src/entities.h @@ -0,0 +1,34 @@ +#ifndef _ENTITIES_H +#define _ENTITIES_H + +#define DIR_RIGHT 0 +#define DIR_LEFT 1 + +#define WALK_DELAY 8 + +typedef struct entity_s +{ + uint8_t used; + uint16_t x; + uint16_t y; + uint8_t dir; + uint8_t frame; + uint8_t delay; + uint8_t gravity; + uint8_t flag; + uint8_t bg[16 * 16]; + /* expected to be 2 directions per 4 frames max; 8 Rect */ + const Rect *frames; + void (*update)(struct entity_s *e); +} Entity; + +void entities_init(); + +Entity *entities_new(); + +void entities_update(); + +void entities_erase(); +void entities_draw(); + +#endif /* _ENTITIES_H */ |