diff options
| author | arngo <[email protected]> | 2024-05-12 17:55:35 -0400 |
|---|---|---|
| committer | arngo <[email protected]> | 2024-05-12 17:55:35 -0400 |
| commit | c649f3b0bf74804b959aa925487495d8b823f938 (patch) | |
| tree | 6c69eecfa56b4383e6e2e552a21fde09aa952b4b /src/bullet.c | |
| parent | f1060dd5f62a87c0076c10a89287e8a7a0defd07 (diff) | |
| download | tojam2024-c649f3b0bf74804b959aa925487495d8b823f938.tar.gz tojam2024-c649f3b0bf74804b959aa925487495d8b823f938.zip | |
try again
Diffstat (limited to 'src/bullet.c')
| -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 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; + } } } |
