alternate walk animation
This commit is contained in:
parent
4d47bb9ecf
commit
608e5a0331
|
@ -36,6 +36,7 @@ Creature::Creature() : Thing(Otc::Creature)
|
|||
m_walking = false;
|
||||
m_walkOffsetX = 0;
|
||||
m_walkOffsetY = 0;
|
||||
m_walkCount = 0;
|
||||
|
||||
m_informationFont = g_fonts.getFont("tibia-12px-rounded");
|
||||
}
|
||||
|
@ -124,8 +125,7 @@ void Creature::draw(int x, int y)
|
|||
else if(m_direction == Otc::West || m_direction == Otc::NorthWest || m_direction == Otc::SouthWest)
|
||||
m_walkOffsetX = std::max(m_walkOffsetX - pixelsWalked, 0);
|
||||
|
||||
int walkOffset = std::max(fabs(m_walkOffsetX), fabs(m_walkOffsetY));
|
||||
|
||||
int walkOffset = std::max(std::abs(m_walkOffsetX), std::abs(m_walkOffsetY));
|
||||
if(walkOffset % 8 == 0) {
|
||||
if(m_animation+1 == attributes.animcount)
|
||||
m_animation = 1;
|
||||
|
@ -251,6 +251,8 @@ void Creature::walk(const Position& position)
|
|||
m_walkTimePerPixel = walkTime / 32.0;
|
||||
|
||||
m_lastTicks = g_platform.getTicks();
|
||||
m_walkCount++;
|
||||
m_animation = (m_walkCount % 2) + 1;
|
||||
}
|
||||
|
||||
void Creature::setHealthPercent(uint8 healthPercent)
|
||||
|
|
|
@ -92,6 +92,7 @@ private:
|
|||
Color m_informationColor;
|
||||
|
||||
int m_lastTicks;
|
||||
int m_walkCount;
|
||||
bool m_walking;
|
||||
float m_walkTimePerPixel;
|
||||
Position m_walkingFromPosition;
|
||||
|
|
Loading…
Reference in New Issue