From 7fa5b3c842c276859c7d4016b9660e1b16ac30c5 Mon Sep 17 00:00:00 2001 From: quou Date: Thu, 4 May 2023 14:21:23 +1000 Subject: Add entity destruction. --- bullet.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'bullet.c') 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); + } } } } -- cgit v1.2.3-54-g00ecf