diff options
Diffstat (limited to 'src/wall.c')
| -rw-r--r-- | src/wall.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/wall.c b/src/wall.c new file mode 100644 index 0000000..6ee3a2a --- /dev/null +++ b/src/wall.c @@ -0,0 +1,29 @@ +#include <raylib.h> +#include "wall.h" + +void add_wall(float xpos, float ypos, float width, float height) { + struct entity wall = { + .type = Wall_Entity, + .flags = (ENTITY_ACTIVE | ENTITY_COLLISION_ACTIVE | ENTITY_VISIBLE), + + .position = { + .x = xpos, + .y = ypos + }, + .velocity = (Vector2) {0}, + + .collider = (Rectangle) { + .x = xpos - width / 2, + .y = ypos - height / 2, + .width = width, + .height = height + }, + }; + + + add_entity(&wall); +} + +void draw_wall(const struct entity* wall) { + DrawRectangleRec(get_entity_collider_world(wall), RED); +} |
