Add weapons

This commit is contained in:
2024-01-06 19:54:22 +01:00
parent dbc0ce5981
commit f667614cfe
398 changed files with 1209 additions and 66 deletions

View File

@@ -12,8 +12,14 @@ void actionMoveTo(ecs_entity_t entity, Action *action, Game *game) {
entitySetPath(entity, target, game);
return;
}
Vector2 pos = *ecs_get(ECS, entity, Position);
const f32 dt = GetFrameTime();
const Vector2 pos = *ecs_get(ECS, entity, Position);
if (ecs_has(ECS, entity, Orientation)) {
Orientation *orientation = ecs_get_mut(ECS, entity, Orientation);
f32 dif = Vector2Angle(pos, target) - *orientation;
dif = Clamp(dif, -10, 10) * dt * 10;
*orientation += dif;
}
f32 dst = Vector2Distance(pos, target);
if (dst < action->as.moveTo.proximityThreshold) {
action->finished = true;