Add weapons
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user