aboutsummaryrefslogtreecommitdiff
path: root/src/entities.h
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-06-25 22:44:23 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-06-25 22:44:23 +0100
commit6bd6757583510ba3edf75451309e4b8ec8c9b0f1 (patch)
treee63f401238e4118ff6d1670ea86508f0181c19ea /src/entities.h
parent2d7fbc07acf0c5766d662d2629e72600b65f744b (diff)
downloadgold-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.h34
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 */