diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-20 03:08:57 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-20 03:08:57 -0600 |
commit | 43e31b6e124da754ef928d22fbb9a1d7640aab4b (patch) | |
tree | 698f723866bd99982a6c606c63cfa0387863e2db /src/entity.c | |
parent | f3f5fedbf591c10fa675a32103bab9480b42abe8 (diff) |
New bullet system
Diffstat (limited to 'src/entity.c')
-rw-r--r-- | src/entity.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/entity.c b/src/entity.c index 285744d..9c6e5e3 100644 --- a/src/entity.c +++ b/src/entity.c @@ -60,7 +60,8 @@ Entity createEntity(EntityType type, Game * game) { .useAcceleration = false, .updateCb = info.updateCb, .drawCb = info.drawCb, - .health = 1.0, + .health = ENTITY_MAX_HEALTH, + .collision.hit = false, .data = NULL }; @@ -74,6 +75,28 @@ void closeEntity(Entity * entity) { entityTypeInfo[entity->type].closeCb(entity); } +bool entitiesCollide(Entity entity1, Entity entity2) { + int i; + Vector3 triangle[3]; + + /* + for (i = 0; i < mesh.triangleCount; ++i) { + + for (j = 0; j < 3; ++j) + triangle[j] = (Vector3){ + mesh.vertices[(i * 9) + (j * 3)], + mesh.vertices[(i * 9) + (j * 3) + 1], + mesh.vertices[(i * 9) + (j * 3) + 2], + }; + + DrawLine3D(triangle[0], triangle[1], BLUE); + DrawLine3D(triangle[1], triangle[2], BLUE); + DrawLine3D(triangle[2], triangle[0], BLUE); + } + */ + return false; +} + // Basic wireframe drawing. void entityDraw(Entity * entity) { entity->model->transform = QuaternionToMatrix(entity->rotation); @@ -81,7 +104,7 @@ void entityDraw(Entity * entity) { DrawModelWires( *entity->model, entity->position, - 1, + 1.0, GREEN ); } @@ -107,6 +130,7 @@ void entityUpdateRotation(Entity * entity) { ); entity->rotation = QuaternionMultiply(entity->rotation, angularRotation); + entity->rotation = QuaternionNormalize(entity->rotation); } void entityJoystickControl(Entity * entity, Vector3 stick, float speed) { |