void PlayerSystem::receive(const KeyDownEvent &kde)
{
auto kc = kde.keycode;
+ auto& loc = *game::entities.get(pid).component<Position>().get();
+ auto& faceLeft = game::entities.get(pid).component<Sprite>().get()->faceLeft;
/*auto worldSwitch = [&](const WorldSwitchInfo& wsi){
player->canMove = false;
}*/
} else if (kc == getControl(1)) {
if (!ui::fadeEnable) {
- moveLeft = true;
+ moveLeft = faceLeft = true;
moveRight = false;
- /*if (currentWorldToLeft) {
- std::thread([&](void){
- auto thing = currentWorld->goWorldLeft(p);
- if (thing.first != currentWorld)
- worldSwitch(thing);
- }).detach();
- }*/
+ game::engine.getSystem<WorldSystem>()->goWorldLeft(loc);
}
} else if (kc == getControl(2)) {
if (!ui::fadeEnable) {
- moveLeft = false;
+ moveLeft = faceLeft = false;
moveRight = true;
- /*if (currentWorldToRight) {
- std::thread([&](void){
- auto thing = currentWorld->goWorldRight(p);
- if (thing.first != currentWorld)
- worldSwitch(thing);
- }).detach();
- }*/
- }
+ game::engine.getSystem<WorldSystem>()->goWorldRight(loc);
+ }
} else if (kc == getControl(3)) {
if (game::canSprint)
speed = 2.0f;