System now controls the motion better since it's not GUIs job.
This commit is contained in:
parent
1973a7a1df
commit
e85b5d998b
3 changed files with 10 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue