summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorarngo <[email protected]>2024-05-12 17:55:35 -0400
committerarngo <[email protected]>2024-05-12 17:55:35 -0400
commitc649f3b0bf74804b959aa925487495d8b823f938 (patch)
tree6c69eecfa56b4383e6e2e552a21fde09aa952b4b
parentf1060dd5f62a87c0076c10a89287e8a7a0defd07 (diff)
downloadtojam2024-c649f3b0bf74804b959aa925487495d8b823f938.tar.gz
tojam2024-c649f3b0bf74804b959aa925487495d8b823f938.zip
try again
-rw-r--r--src/bullet.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bullet.c b/src/bullet.c
index fb8def6..06e521d 100644
--- a/src/bullet.c
+++ b/src/bullet.c
@@ -72,11 +72,21 @@ 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))
+ Vector3 enemypos;
+ if (bullets[i].team == 1)
{
- world.players[bullets[i].team-1].points++;
- bullets[i].team = 0;
+ enemypos = world.players[0].position;
+ }
+ else if (bullets[i].team == 2)
+ {
+ enemypos = world.players[1].position;
+ }
+ if (bullets[i].team != 0) {
+ if (Vector3Distance(bullets[i].position, enemypos))
+ {
+ world.players[bullets[i].team-1].points++;
+ bullets[i].team = 0;
+ }
}
}