Player's aim is now updated constantly as they move, just need to solve #57 to complete it. Closes #9.
This commit is contained in:
parent
584c4e9f67
commit
a26f0b0c0a
7 changed files with 48 additions and 27 deletions
14
systems.cpp
14
systems.cpp
|
@ -396,12 +396,15 @@ void System::device(World &world, Entity actor, Entity item) {
|
|||
}
|
||||
}
|
||||
|
||||
void System::plan_motion(World& world, Point move_to) {
|
||||
void System::plan_motion(World& world, Position move_to) {
|
||||
auto& player = world.get_the<Player>();
|
||||
auto& player_position = world.get<Position>(player.entity);
|
||||
|
||||
player_position.aiming_at = move_to.aiming_at;
|
||||
|
||||
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;
|
||||
motion.dx = move_to.location.x - player_position.location.x;
|
||||
motion.dy = move_to.location.y - player_position.location.y;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -554,3 +557,8 @@ void System::remove_from_container(World& world, Entity cont_id, const std::stri
|
|||
auto entity = container.get(slot_id);
|
||||
container.remove(entity);
|
||||
}
|
||||
|
||||
Position& System::player_position(GameLevel& level) {
|
||||
auto& player = level.world->get_the<components::Player>();
|
||||
return level.world->get<components::Position>(player.entity);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue