aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 4c3ba81..a9138c7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -506,6 +506,8 @@ void logic(){
e->near = false;
continue;
} else if (e->canMove) {
+ if (!currentWorld->goWorldLeft(dynamic_cast<NPC *>(e)))
+ currentWorld->goWorldRight(dynamic_cast<NPC *>(e));
e->wander((rand() % 120 + 30));
if (NPCSelected) {
e->near = false;
@@ -520,8 +522,13 @@ void logic(){
else
NPCSelected = true;
- if ((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)) && !ui::dialogBoxExists)
+ if ((SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT)) && !ui::dialogBoxExists) {
+ if (ui::mouse.x < player->loc.x && player->right)
+ player->left = true, player->right = false;
+ else if(ui::mouse.x > player->loc.x && player->left)
+ player->right = true, player->left = false;
e->interact();
+ }
} else {
e->near = false;
}