From 6d928722369bc1db7f17d3fb0d0cb69ce304d39b Mon Sep 17 00:00:00 2001 From: Dennis Friis Date: Thu, 30 Oct 2008 20:13:26 +0000 Subject: Minor fixes to movement and hit effects. Patch by Kage_Jittai. --- src/being.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/being.cpp') 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); } -- cgit v1.2.3-60-g2f50