diff options
author | Bertram <bertram@cegetel.net> | 2010-03-03 20:33:40 +0100 |
---|---|---|
committer | Bertram <yohanndotferreiraatorange.fr> | 2010-04-12 23:50:22 +0200 |
commit | 27c7c5f725f5cf1e3393df9393b08fdc26057212 (patch) | |
tree | 566f9d7b043e7482331a0091f03daacd0d095db9 /src/being.cpp | |
parent | 1bc96ba79136e8e47c077039d09e8a027569bcdb (diff) | |
download | mana-27c7c5f725f5cf1e3393df9393b08fdc26057212.tar.gz mana-27c7c5f725f5cf1e3393df9393b08fdc26057212.tar.bz2 mana-27c7c5f725f5cf1e3393df9393b08fdc26057212.tar.xz mana-27c7c5f725f5cf1e3393df9393b08fdc26057212.zip |
Added the player collision rectangle and tweaked colors
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 200f38cf..2500061a 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -150,11 +150,10 @@ void Being::setDestination(int dstX, int dstY) if (!mMap->getWalk(dstX / 32, dstY / 32)) return; - // The being radius should be obtained from xml values. - Position dest = mMap->checkNodeOffsets(getWidth() / 2, getWalkMask(), + Position dest = mMap->checkNodeOffsets(getCollisionRadius(), getWalkMask(), dstX, dstY); Path thisPath = mMap->findPixelPath(mPos.x, mPos.y, dest.x, dest.y, - getWidth() / 2, getWalkMask()); + getCollisionRadius(), getWalkMask()); if (thisPath.empty()) { @@ -511,6 +510,17 @@ void Being::nextTile() mWalkTime += (int)(mWalkSpeed.x / 10); } +int Being::getCollisionRadius() const +{ + // FIXME: Get this from XML file + int radius = getWidth() / 2; + if (radius > 32 / 2) radius = 32 / 2; + // set a default value if no value returned. + if (radius < 1) radius = 32 / 3; + + return radius; +} + void Being::logic() { // Reduce the time that speech is still displayed |