walk animation improv

This commit is contained in:
Eduardo Bart 2011-11-05 19:43:13 -02:00
parent d2c3e554dc
commit 4208e40c76
1 changed files with 7 additions and 3 deletions

View File

@ -227,8 +227,7 @@ void Creature::walk(const Position& position, bool inverse)
m_walkTimePerPixel = walkTime / 32.0; m_walkTimePerPixel = walkTime / 32.0;
if(!sameWalk) if(!sameWalk)
m_walkStartTicks = g_platform.getTicks(); m_walkStartTicks = g_platform.getTicks();
updateWalk();
g_dispatcher.scheduleEvent(std::bind(&Creature::updateWalk, asCreature()), m_walkTimePerPixel);
} }
} }
@ -280,8 +279,13 @@ void Creature::cancelWalk(Otc::Direction direction)
m_walkStartTicks = 0; m_walkStartTicks = 0;
m_walkOffsetX = 0; m_walkOffsetX = 0;
m_walkOffsetY = 0; m_walkOffsetY = 0;
m_animation = 0;
m_direction = direction; m_direction = direction;
auto self = asCreature();
g_dispatcher.scheduleEvent([=]() {
if(!self->m_walking)
self->m_animation = 0;
}, 150);
} }
void Creature::setHealthPercent(uint8 healthPercent) void Creature::setHealthPercent(uint8 healthPercent)