summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorBertram <bertram@cegetel.net>2009-10-22 01:18:41 +0200
committerBertram <bertram@cegetel.net>2009-10-22 01:18:41 +0200
commit4720134d58cd5fe0846ed911b360ed75641cb874 (patch)
tree3ac3292f26a30971f424bdbd794f4daf3159adfe /src/being.cpp
parentc36ab53b35e336e21fce5943d7d609ea02f8cea9 (diff)
downloadmana-client-4720134d58cd5fe0846ed911b360ed75641cb874.tar.gz
mana-client-4720134d58cd5fe0846ed911b360ed75641cb874.tar.bz2
mana-client-4720134d58cd5fe0846ed911b360ed75641cb874.tar.xz
mana-client-4720134d58cd5fe0846ed911b360ed75641cb874.zip
Fix flipping player's direction when using keyboard to walk diagonally.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d133225f..69e01dba 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -575,7 +575,13 @@ void Being::logic()
// Update the player sprite direction
int direction = 0;
const float dx = std::abs(dir.x);
- const float dy = std::abs(dir.y);
+ float dy = std::abs(dir.y);
+
+ // When not using mouse for the player, we slightly prefer
+ // UP and DOWN position, especially when walking diagonally.
+ if (this == player_node && !player_node->isPathSetByMouse())
+ dy = dy + 2;
+
if (dx > dy)
direction |= (dir.x > 0) ? RIGHT : LEFT;
else