diff options
| author | realtradam <[email protected]> | 2024-05-12 17:54:20 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2024-05-12 17:54:20 -0400 |
| commit | b8a6787466516de2423f787817a33ca3ac7141a2 (patch) | |
| tree | 5a0661a11b77b1647e8f1dd3ac707b91489aeb05 | |
| parent | 9bd7b679ba010b31ec01424289200c3d138a8793 (diff) | |
| parent | c649f3b0bf74804b959aa925487495d8b823f938 (diff) | |
| download | tojam2024-b8a6787466516de2423f787817a33ca3ac7141a2.tar.gz tojam2024-b8a6787466516de2423f787817a33ca3ac7141a2.zip | |
Merge branch 'master' of github.com:realtradam/tojam2024
| -rw-r--r-- | src/bullet.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/bullet.c b/src/bullet.c index b5afab4..3ba8f68 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; + } } } |
