use slab aabb for gunshots
This commit is contained in:
@@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
|
void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
|
||||||
if (
|
if (
|
||||||
world->player.controls.shot
|
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, bandit->collision) && bandit->currentArea == world->player.currentArea)
|
||||||
&& AABB_Point(bandit->collision, world->player.shotPos)
|
{
|
||||||
&& bandit->currentArea == world->player.currentArea
|
|
||||||
) {
|
|
||||||
printf("You shot the bandit %*.s\n", Sv(bandit->name));
|
printf("You shot the bandit %*.s\n", Sv(bandit->name));
|
||||||
bandit->health--;
|
bandit->health--;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,8 @@ void UpdateNPCs(F32 delta, World *world)
|
|||||||
NPC *npc = &world->npcs[i];
|
NPC *npc = &world->npcs[i];
|
||||||
UpdateNPC(delta, npc, world);
|
UpdateNPC(delta, npc, world);
|
||||||
if (
|
if (
|
||||||
world->player.controls.shot
|
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, npc->collision) && npc->currentArea == world->player.currentArea)
|
||||||
&& AABB_Point(npc->collision, world->player.shotPos)
|
{
|
||||||
&& npc->currentArea == world->player.currentArea
|
|
||||||
) {
|
|
||||||
printf("You shot %*.s\n", Sv(world->npcs[i].name));
|
printf("You shot %*.s\n", Sv(world->npcs[i].name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user