|
|
|
@ -44,16 +44,8 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
void FSM::MOVING(Event ) { |
|
|
|
|
if($camera.play_move($rayview)) { |
|
|
|
|
// really annoying but we have to figure out the motion factor then run the systems
|
|
|
|
|
auto& player = level.world->get_the<Player>(); |
|
|
|
|
auto& player_position = level.world->get<Position>(player.entity); |
|
|
|
|
auto& motion = level.world->get<Motion>(player.entity); |
|
|
|
|
Point move_to{size_t($camera.targetX), size_t($camera.targetY)}; |
|
|
|
|
motion.dx = move_to.x - player_position.location.x; |
|
|
|
|
motion.dy = move_to.y - player_position.location.y; |
|
|
|
|
|
|
|
|
|
System::plan_motion(*level.world, {size_t($camera.targetX), size_t($camera.targetY)}); |
|
|
|
|
run_systems(); |
|
|
|
|
|
|
|
|
|
state(State::IDLE); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|