aboutsummaryrefslogtreecommitdiff
path: root/src/entities/soldato.c
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-18 05:54:30 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-18 05:54:30 -0600
commitf3f5fedbf591c10fa675a32103bab9480b42abe8 (patch)
tree54b46a23279cc45091393762c0d01b9c3637b729 /src/entities/soldato.c
parent77a06748f9f394486cad833e2ca351e8dbcc7361 (diff)
Bullet system added
Diffstat (limited to 'src/entities/soldato.c')
-rw-r--r--src/entities/soldato.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/entities/soldato.c b/src/entities/soldato.c
index 30dfa6b..beec40a 100644
--- a/src/entities/soldato.c
+++ b/src/entities/soldato.c
@@ -7,19 +7,19 @@ void initSoldato(Entity * entity, Game * game) {
// Acceleration.
entity->useAcceleration = true;
entity->acceleration = (EntityAcceleration){
- .speedUp = 5.0,
- .speedDown = 0.00001
+ .speedUp = 20.0,
+ .speedDown = 15.0
};
// PID configs.
PIDConfig speedPIDConfig = {
- .kP = -0.5,
+ .kP = 1,
.kI = 0.0,
.kD = 0.0,
.angleMode = false,
.doClamp = true,
.min = 0.0,
- .max = 30.0
+ .max = 100.0
};
// Allocate data.
@@ -31,7 +31,15 @@ void initSoldato(Entity * entity, Game * game) {
}
Soldato * data = (Soldato*)entity->data;
- data->speedPID = createPID(speedPIDConfig);
+
+ // Create fly to point.
+ data->flyToPoint = (EntityFlyToPointInfo){
+ //.controller.speedPID = createPID(speedPIDConfig),
+ .controller.bangbang.speed = 20.0,
+ .controller.bangbang.stopAt = 0.0,
+ .controlType = ENTITY_FLY_TO_POINT_BANG_BANG,
+ .rotationSpeed = 0.0
+ };
}
void closeSoldato(Entity * entity) {
@@ -43,11 +51,10 @@ void updateSoldato(Game * game, Entity * entity) {
Entity * player = getEntityFromWorld(game->world, 0);
Soldato * data = (Soldato*)entity->data;
- entityFlightToPoint(
+ entityFlyToPoint(
entity,
player->position,
- &data->speedPID,
- 5.0
+ &data->flyToPoint
);
}