diff options
-rw-r--r-- | src/being.cpp | 9 | ||||
-rw-r--r-- | src/localplayer.cpp | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp index 7b77ed5a..69f873a2 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -315,7 +315,7 @@ void Being::takeDamage(int amount) { // Hit particle effect controlParticle(particleEngine->addEffect( - "graphics/particles/hit.particle.xml", 0, 0)); + "graphics/particles/hit.particle.xml", mPos.x, mPos.y)); if (getType() == MONSTER) { @@ -465,8 +465,7 @@ void Being::logic() // the jigger caused by moving too far. if (length > 2.0f) { const float speed = mWalkSpeed / 100.0f; - dir /= (length / speed); - mPos += dir; + mPos += dir / (length / speed); if (mAction != WALK) setAction(WALK); @@ -475,9 +474,9 @@ void Being::logic() int direction = 0; const float dx = std::abs(dir.x); const float dy = std::abs(dir.y); - if (dx * 2 > dy) + if (dx > dy) direction |= (dir.x > 0) ? RIGHT : LEFT; - if (dy * 2 > dx) + else direction |= (dir.y > 0) ? DOWN : UP; setDirection(direction); } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index b6f478a0..fce9506a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -47,7 +47,7 @@ #include "utils/tostring.h" #include "utils/gettext.h" -const short walkingKeyboardDelay = 500; +const short walkingKeyboardDelay = 100; LocalPlayer *player_node = NULL; @@ -262,6 +262,7 @@ void LocalPlayer::walk(unsigned char dir) if (dir & RIGHT) dx += 32; + // Prevent skipping corners over colliding tiles if (dx && !mMap->getWalk(((int) pos.x + dx) / 32, (int) pos.y / 32, getWalkMask())) @@ -274,10 +275,10 @@ void LocalPlayer::walk(unsigned char dir) if (dx && dy && !mMap->getWalk((pos.x + dx) / 32, (pos.y + dy) / 32, getWalkMask())) dx = 16 - (int) pos.x % 32; - + // Checks our path up to 5 tiles, if a blocking tile is found // We go to the last good tile, and break out of the loop - for (dScaler = 1; dScaler <= 5; dScaler++) + for (dScaler = 1; dScaler <= 10; dScaler++) { if ( (dx || dy) && !mMap->getWalk( ((int) pos.x + (dx * dScaler)) / 32, @@ -319,7 +320,6 @@ void LocalPlayer::setDestination(Uint16 x, Uint16 y) x = tx * 32 + fx; y = ty * 32 + fy; - // Only send a new message to the server when destination changes if (x != mDestX || y != mDestY) { |