System now controls the motion better since it's not GUIs job.

This commit is contained in:
Zed A. Shaw 2025-02-06 12:13:22 -05:00
parent 1973a7a1df
commit e85b5d998b
3 changed files with 10 additions and 9 deletions

View file

@ -213,3 +213,11 @@ void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En
println("entity {} INTERACTED WITH DEVICE {}", actor, item);
}
void System::plan_motion(DinkyECS::World& world, Point move_to) {
auto& player = world.get_the<Player>();
auto& player_position = world.get<Position>(player.entity);
auto& motion = world.get<Motion>(player.entity);
motion.dx = move_to.x - player_position.location.x;
motion.dy = move_to.y - player_position.location.y;
}