aboutsummaryrefslogtreecommitdiff
path: root/solid.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-06 12:22:50 +1000
committerquou <quou@disroot.org>2023-05-06 12:22:50 +1000
commit937edea9599718e959f8ed135e97c68728855975 (patch)
treeea5d5551b470603d2d907dba4869ff52e742d9de /solid.c
parent91aef268319a77ee8f5a082ca89264bf2671e212 (diff)
Add solid environment collisions.
Diffstat (limited to 'solid.c')
-rw-r--r--solid.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/solid.c b/solid.c
new file mode 100644
index 0000000..40c3656
--- /dev/null
+++ b/solid.c
@@ -0,0 +1,27 @@
+#include "solid.h"
+
+Entity new_solid(World* world, int x, int y, int w, int h) {
+ Entity e;
+ CCollider* col;
+ CPosition* pos;
+
+ e = new_entity(world);
+ add_components(
+ world,
+ e,
+ ctype_position |
+ ctype_collider |
+ ctype_solid
+ );
+ pos = &world->positions[e];
+ col = &world->colliders[e];
+
+ pos->x = x;
+ pos->y = y;
+ col->x = 0;
+ col->y = 0;
+ col->w = w;
+ col->h = h;
+
+ return e;
+}