diff options
Diffstat (limited to 'src/control')
-rw-r--r-- | src/control/MapContext.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/control/MapContext.cpp b/src/control/MapContext.cpp index 1904db4..acad969 100644 --- a/src/control/MapContext.cpp +++ b/src/control/MapContext.cpp @@ -37,7 +37,7 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s map.getEntities().emplace_back("square"); playerEntity = &map.getEntities().back(); - playerEntity->moveTo(Model::Position{8, 8}); + playerEntity->moveTo(&map, Model::Position{8, 8}); view->updateEntities(map.getEntities()); @@ -50,14 +50,12 @@ MapContext::MapContext(EventBus *eventBus0, InputHandler *inputHandler0, const s } void MapContext::movePlayer(Model::Direction dir, uint64_t time) { - if (playerEntity->hasTransition()) + if (!playerEntity->move(&map, dir, time, time+250)) return; - playerEntity->move(dir, time, time+250); - eventBus->enqueue( [=] { - playerEntity->finishTransition(); + playerEntity->finishTransition(&map); movePlayerContinue(time+250); }, time+250 |