Add walk animation

This commit is contained in:
2023-12-29 08:02:19 +01:00
parent b667f18b8e
commit 0c9fae7781
4 changed files with 24 additions and 31 deletions

View File

@@ -112,17 +112,17 @@ void inputUnitAction(Game *game, InputState *input) {
if (isInputBtnJustUp(input, actionBtn)) {
// Note: We mustn't use ecs ecs_remove_all since this will also
// remove ongoing paths that are not part of this query.
iterateSelectedUnits(input->queries.selected, iterRemovePaths);
ecs_defer_begin(ECS);
iterateSelectedUnits(query, iterRemovePaths);
ecs_defer_end(ECS);
const Position target = input->mouseWorld;
ecs_iter_t it = ecs_query_iter(ECS, query);
ecs_defer_begin(ECS);
while (ecs_iter_next(&it)) {
const Position *pos = ecs_field(&it, Position, 1);
for (i32 i = 0; i < it.count; i++) {
const ecs_entity_t entity = it.entities[i];
entitySetPath(entity, target, game);
}
}