blob: 6ee3a2ad7fd6593d5baaa96104a3fb471d587d1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
}
|