aboutsummaryrefslogtreecommitdiff
path: root/src/bullets.c
diff options
context:
space:
mode:
authornathansmithsmith <nathansmith7@mailfence.com>2023-07-30 23:51:37 -0600
committernathansmithsmith <nathansmith7@mailfence.com>2023-07-30 23:51:37 -0600
commitfc6e0037a2f0769fdbd4c18bd96f49d55f630757 (patch)
tree79f6561d192c3e6e5887422c6b31beac35eab046 /src/bullets.c
parentf6dc479873edc98704dcf1ffb116ba5da03805b2 (diff)
Started caporale circling thingy
Diffstat (limited to 'src/bullets.c')
-rw-r--r--src/bullets.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/bullets.c b/src/bullets.c
index 1619111..ec5908f 100644
--- a/src/bullets.c
+++ b/src/bullets.c
@@ -43,3 +43,16 @@ BulletHitInfo shootBullet(World * world, Bullet bullet) {
.hitId = ENTITY_NONE,
};
}
+
+BulletHitInfo shootBulletAtEntity(Entity * entity, Bullet bullet) {
+ RayCollision collision = traceRayToEntity(*entity, bullet.ray);
+
+ if (collision.hit)
+ return handleBulletHit(entity, bullet);
+
+ return (BulletHitInfo){
+ .hit = false,
+ .killed = false,
+ .hitId = ENTITY_NONE,
+ };
+}