From 6dbd16cd920b51bc24b60d0561bd707ff8862cc5 Mon Sep 17 00:00:00 2001 From: BoredGuy Date: Thu, 19 Mar 2026 09:43:11 +0300 Subject: Added Walls - And more player mechanics --- src/wall.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/wall.c (limited to 'src/wall.c') 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 +#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); +} -- cgit v1.2.3