diff options
author | Dennis Friis <peavey@placid.dk> | 2008-10-30 20:13:26 +0000 |
---|---|---|
committer | Dennis Friis <peavey@placid.dk> | 2008-10-30 20:13:26 +0000 |
commit | 6d928722369bc1db7f17d3fb0d0cb69ce304d39b (patch) | |
tree | 1a85ace05ff7188603f64b852ae2454f595c44fb /src/being.cpp | |
parent | 9e25bb7db1aae37538327348a40de1361b63ac85 (diff) | |
download | mana-6d928722369bc1db7f17d3fb0d0cb69ce304d39b.tar.gz mana-6d928722369bc1db7f17d3fb0d0cb69ce304d39b.tar.bz2 mana-6d928722369bc1db7f17d3fb0d0cb69ce304d39b.tar.xz mana-6d928722369bc1db7f17d3fb0d0cb69ce304d39b.zip |
Minor fixes to movement and hit effects. Patch by Kage_Jittai.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 9 |
1 files changed, 4 insertions, 5 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); } |