diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-18 05:54:30 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-18 05:54:30 -0600 |
commit | f3f5fedbf591c10fa675a32103bab9480b42abe8 (patch) | |
tree | 54b46a23279cc45091393762c0d01b9c3637b729 /src/entity.h | |
parent | 77a06748f9f394486cad833e2ca351e8dbcc7361 (diff) |
Bullet system added
Diffstat (limited to 'src/entity.h')
-rw-r--r-- | src/entity.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/entity.h b/src/entity.h index c6fa6c6..dc6be72 100644 --- a/src/entity.h +++ b/src/entity.h @@ -64,6 +64,9 @@ typedef struct Entity { EntityUpdateCb updateCb; EntityDrawCb drawCb; + // Health is a percent from 1.0 to 0.0. + float health; + // Used for whatever. void * data; } Entity; @@ -92,7 +95,26 @@ void entityUpdateRotation(Entity * entity); void entityJoystickControl(Entity * entity, Vector3 stick, float speed); -// 0.0 rotationSpeed for directly setting the rotation. -void entityFlightToPoint(Entity * entity, Vector3 point, PID * speedPID, float rotationSpeed); +enum { + ENTITY_FLY_TO_POINT_PID, + ENTITY_FLY_TO_POINT_BANG_BANG +}; + +// Shit for fly to point. +typedef struct EntityFlyToPointInfo { + union { + PID speedPID; + + struct { + float speed; + float stopAt; + } bangbang; + } controller; + + uint8_t controlType; + float rotationSpeed; // 0.0 to not use. +} EntityFlyToPointInfo; + +void entityFlyToPoint(Entity * entity, Vector3 point, EntityFlyToPointInfo * info); #endif |