⚙️ function core_action_move(...)

Last updated: 11/17/2025

URL

https://github.com/42core-team/monorepo/blob/dev/client_lib/src/public/actions.c#L32

Description

Moves a unit to a specific position.

  • Units can only move one tile up, down, left or right; for more see Action Position Limits.
  • Units can only move if their action cooldown is 0, for more see Cooldowns.

Signature

void core_action_move(const t_obj *unit, t_pos pos);

Parameters

  • const t_obj *unit: The unit that should move
  • t_pos pos: The position where the unit should move to

Return

void

Examples

t_obj *target = ft_get_target();
t_obj *moving_unit = ft_get_moving_unit();

if (moving_unit->pos.x < target->pos.x)
{
	core_action_move(moving_unit, (t_pos){moving_unit->pos.x + 1, moving_unit->pos.y});
}
if (moving_unit->pos.y < target->pos.y)
{
	core_action_move(moving_unit, (t_pos){moving_unit->pos.x, moving_unit->pos.y + 1});
}
// ...