diff options
| author | BoredGuy <osome3717@gmail.com> | 2026-03-19 09:43:11 +0300 |
|---|---|---|
| committer | BoredGuy <osome3717@gmail.com> | 2026-03-19 09:43:11 +0300 |
| commit | 6dbd16cd920b51bc24b60d0561bd707ff8862cc5 (patch) | |
| tree | 34add659f1ddb15be4a817b66dbf7c9c194c1576 /src/wall.c | |
| parent | 9b63c2572ee6d8b73fd0d2f298dc339335875607 (diff) | |
Added Walls
- And more player mechanics
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); +} |
