aboutsummaryrefslogtreecommitdiff
path: root/bullet.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-04 14:21:23 +1000
committerquou <quou@disroot.org>2023-05-04 14:21:23 +1000
commit7fa5b3c842c276859c7d4016b9660e1b16ac30c5 (patch)
treef9290a27a7385962b878be19a2647a792ec0dd68 /bullet.c
parentd61dcdcc384249ec7ea60c9cc18aab9df1f80577 (diff)
Add entity destruction.
Diffstat (limited to 'bullet.c')
-rw-r--r--bullet.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bullet.c b/bullet.c
index f2e1a2e..9acefc2 100644
--- a/bullet.c
+++ b/bullet.c
@@ -75,6 +75,10 @@ void bullet_system(World* world) {
pos->x += bullet->vx;
pos->y += bullet->vy;
bullet->life--;
+
+ if (bullet->life <= 0) {
+ destroy_entity(world, i);
+ }
}
}
}