diff options
| author | BoredGuy <osome3717@gmail.com> | 2026-03-15 17:08:36 +0300 |
|---|---|---|
| committer | BoredGuy <osome3717@gmail.com> | 2026-03-15 17:08:36 +0300 |
| commit | 9e24aa042e9fb9de34f7b445778518fcb67e24aa (patch) | |
| tree | eb71468111da570dad7e1117e04a25aeba08e29c /src/entity.c | |
| parent | 0ed3bb4569ded185237c6d530285382e6c2b6200 (diff) | |
Some Updates
Diffstat (limited to 'src/entity.c')
| -rw-r--r-- | src/entity.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/entity.c b/src/entity.c new file mode 100644 index 0000000..4dc32f2 --- /dev/null +++ b/src/entity.c @@ -0,0 +1,39 @@ +#include <stdio.h> +#include <raylib.h> +#include <string.h> +#include "game.h" +#include "entity.h" + +extern struct game game; + +Rectangle get_entity_collider_world(const struct entity* entity) { + return (Rectangle) { + .x = entity->collider.x + entity->position.x, + .y = entity->collider.y + entity->position.y, + .width = entity->collider.width, + .height = entity->collider.height + }; +} + +void entity_handle_collision +( + struct entity*, + struct entity*, + enum direction + ) { +} + +void draw_entity(const struct entity* entity) { + DrawRectangleRec(get_entity_collider_world(entity), RED); +} + +void add_entity(const struct entity* e) { + for (int i = 0; i < MAX_ENTITY_COUNT; i++) { + struct entity* current = &game.entities[i]; + if (entity_active(current)) + continue; + + memcpy(current, e, sizeof(struct entity)); + return; + } +} |
