summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorarngo <[email protected]>2024-05-12 17:49:47 -0400
committerarngo <[email protected]>2024-05-12 17:49:47 -0400
commita88de0a1ab4bf6e254cfecc14407876fb0a32a4d (patch)
treec8e7c3e56e68339c0940bd51af33ed0ca5e36723
parent13bd9e293e8ed12f39d7b97036abfad69b84ed19 (diff)
downloadtojam2024-a88de0a1ab4bf6e254cfecc14407876fb0a32a4d.tar.gz
tojam2024-a88de0a1ab4bf6e254cfecc14407876fb0a32a4d.zip
bullet point
-rw-r--r--src/bullet.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bullet.c b/src/bullet.c
index 785ce2f..271d14a 100644
--- a/src/bullet.c
+++ b/src/bullet.c
@@ -1,4 +1,6 @@
#include "bullet.h"
+#include "world.h"
+#include "raymath.h"
typedef
struct
@@ -53,7 +55,7 @@ render_bullets(void)
}
}
- void
+void
bullet_collision_check(void)
{
for(int i = 0; i < 100; ++i)
@@ -70,6 +72,12 @@ bullet_collision_check(void)
bullets[i].position.x += bullets[i].direction.x * 0.25;
bullets[i].position.y += bullets[i].direction.y * 0.25;
bullets[i].position.z += bullets[i].direction.z * 0.25;
+ Vector3 enemypos = world.players[bullets[i].team-1].position;
+ if (Vector3Distance(world.players[0].position, enemypos))
+ {
+ world.players[bullets[i].team-1].points++;
+ bullets[i].team = 0;
+ }
}
}