diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-23 18:53:25 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-23 18:53:25 -0600 |
commit | 5a3b3a062862cdeee96b3ec4641ac684b28659f8 (patch) | |
tree | 2994bea3543c1bc694f18f2bc26b0459178759fa /src/world.c | |
parent | a408b352f13df546b2262ca01cf162b60891cdae (diff) |
Soldato following
Diffstat (limited to 'src/world.c')
-rw-r--r-- | src/world.c | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/src/world.c b/src/world.c index 1a3edde..946a283 100644 --- a/src/world.c +++ b/src/world.c @@ -1,5 +1,7 @@ #include "world.h" #include "game.h" +#include "entity.h" +#include "entitiesInclude.h" void initWorld(World * world) { world->entities = NULL; @@ -226,12 +228,30 @@ KfError removeEntityFromWorld(World * world, EntityId id) { } void handleCollisionInWorld(Entity * entity1, Entity * entity2) { - if (entity1->id != 0) - entity1->health = 0.0; - if (entity2->id != 0) - entity2->health = 0.0; - - puts("cc"); + //if (entity1->id != 0) + // entity1->health = 0.0; + //if (entity2->id != 0) + // entity2->health = 0.0; + + switch (entity1->type) { + case ENTITY_ANTIFA: + break; + case ENTITY_SOLDATO: + setSoldatoLeader(entity1, entity2); + break; + case ENTITY_CAPORALE: + break; + case ENTITY_SERGENTE: + break; + case ENTITY_MARESCIALLO: + break; + case ENTITY_GENERALE: + break; + case ENTITY_MUSSOLINI: + break; + default: + break; + } } void updateWorld(World * world, Game * game) { @@ -255,8 +275,15 @@ void updateWorld(World * world, Game * game) { entity2 = &world->entities[j]; // Collided. - if (checkEntityCollision(entity, entity2)) - handleCollisionInWorld(entity, entity2); + // Only use real collision if player is there. + if (entity->id == ENTITY_ANTIFA || entity2->id == ENTITY_ANTIFA) { + if (checkEntityCollision(entity, entity2)) + handleCollisionInWorld(entity, entity2); + } else { + if (Vector3Distance(entity->position, entity2->position) <= + entity->radius + entity2->radius) + handleCollisionInWorld(entity, entity2); + } } // It fucking died. |