From f3f5fedbf591c10fa675a32103bab9480b42abe8 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Tue, 18 Jul 2023 05:54:30 -0600 Subject: Bullet system added --- src/entity.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/entity.h') 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 -- cgit v1.2.3