diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-11 12:10:36 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-04-11 12:10:36 +0000 |
commit | a85e6c544912b9ebd261b5da29b26e3232284173 (patch) | |
tree | 07b989c73225d0855e9a4298de002f8fce2d3f0c /src/engine.cpp | |
parent | 2eae5c2914731091ee25929250a701e5e2c2c724 (diff) | |
download | mana-a85e6c544912b9ebd261b5da29b26e3232284173.tar.gz mana-a85e6c544912b9ebd261b5da29b26e3232284173.tar.bz2 mana-a85e6c544912b9ebd261b5da29b26e3232284173.tar.xz mana-a85e6c544912b9ebd261b5da29b26e3232284173.zip |
- First step toward syncing attack animation with attack speed
- Added a nice sample when attacking to stress test sound engine/
loading samples through resource manager.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 940bac79..2dca09e2 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -265,14 +265,23 @@ void Engine::logic() Being *being = (*beingIterator); if (being->job < 10) { // A player - if (being->action != STAND && being->action != SIT - && being->action != DEAD) { - being->frame = - (get_elapsed_time(being->walk_time) * 4) / (being->speed); - - if (being->frame >= 4) { - being->nextStep(); - } + switch (being->action) { + case WALK: + being->frame = (get_elapsed_time(being->walk_time) * 4) / + (being->speed); + if (being->frame >= 4) { + being->nextStep(); + } + break; + case ATTACK: + being->frame = (get_elapsed_time(being->walk_time) * 4) / + (being->aspd); + if (being->frame >= 4) { + being->nextStep(); + } + break; + default: + break; } } @@ -493,7 +502,7 @@ void Engine::draw() std::stringstream debugStream; debugStream << "[" << fps << " fps] " << (mouseX / 32 + camera_x) << ", " << (mouseY / 32 + camera_y) << " " - << (int)player_node->frame; + << player_node->aspd; debugInfo->setCaption(debugStream.str()); debugInfo->adjustSize(); } |