summaryrefslogtreecommitdiffhomepage
path: root/src/bullet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bullet.c')
-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;
+ }
}
}