diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-21 23:23:16 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-21 23:23:16 +0200 |
commit | 63112267be277e38224b510ec5745421dd7d4917 (patch) | |
tree | ab3ae7990cb49d61382bd0cd225fbe53d329f4a0 /src/being.cpp | |
parent | 05ea95733e9ec89626e08989e0688e73d1408d3a (diff) | |
download | plus-63112267be277e38224b510ec5745421dd7d4917.tar.gz plus-63112267be277e38224b510ec5745421dd7d4917.tar.bz2 plus-63112267be277e38224b510ec5745421dd7d4917.tar.xz plus-63112267be277e38224b510ec5745421dd7d4917.zip |
Add diagonal animations.
New animation names: upleft, upright, downleft, downright
Tested atleast at mobs.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/being.cpp b/src/being.cpp index f382253e2..8cde401f2 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -947,13 +947,31 @@ void Being::setDirection(Uint8 direction) SpriteDirection dir; if (mFaceDirection & UP) - dir = DIRECTION_UP; + { + if (mFaceDirection & LEFT) + dir = DIRECTION_UPLEFT; + else if (mFaceDirection & RIGHT) + dir = DIRECTION_UPRIGHT; + else + dir = DIRECTION_UP; + } else if (mFaceDirection & DOWN) - dir = DIRECTION_DOWN; + { + if (mFaceDirection & LEFT) + dir = DIRECTION_DOWNLEFT; + else if (mFaceDirection & RIGHT) + dir = DIRECTION_DOWNRIGHT; + else + dir = DIRECTION_DOWN; + } else if (mFaceDirection & RIGHT) + { dir = DIRECTION_RIGHT; + } else + { dir = DIRECTION_LEFT; + } mSpriteDirection = dir; CompoundSprite::setDirection(dir); |