use slab aabb for gunshots

This commit is contained in:
declan committed 2025-10-06 00:48:41 +01:00
1 parent b09bdc6209
commit 24e9b472c3
2 files changed
+6 -10

No files matched your search

+3 -5
View File
@@ -2,11 +2,9 @@
#include "game/bandit.h"
void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
if(
world->player.controls.shot
&& AABB_Point(bandit->collision, world->player.shotPos)
&& bandit->currentArea == world->player.currentArea
) {
if (
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, bandit->collision) && bandit->currentArea == world->player.currentArea)
{
printf("You shot the bandit %*.s\n", Sv(bandit->name));
bandit->health--;
}
+3 -5
View File
@@ -18,11 +18,9 @@ void UpdateNPCs(F32 delta, World *world)
{
NPC *npc = &world->npcs[i];
UpdateNPC(delta, npc, world);
if(
world->player.controls.shot
&& AABB_Point(npc->collision, world->player.shotPos)
&& npc->currentArea == world->player.currentArea
) {
if (
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, npc->collision) && npc->currentArea == world->player.currentArea)
{
printf("You shot %*.s\n", Sv(world->npcs[i].name));
}
}