1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Implement WalkLeft and WalkRight character states

This commit is contained in:
Chris Robinson 2013-01-19 16:19:47 -08:00
parent a7b07ee5cf
commit 68779375b2
3 changed files with 12 additions and 1 deletions

View File

@ -273,7 +273,14 @@ namespace MWMechanics
if(dir.length() >= 0.1f)
{
if(dir.y < 0.0f)
if(std::abs(dir.x/2.0f) > std::abs(dir.y))
{
if(dir.x > 0.0f)
newstate = CharState_WalkRight;
else if(dir.x < 0.0f)
newstate = CharState_WalkLeft;
}
else if(dir.y < 0.0f)
newstate = CharState_WalkBack;
else
newstate = CharState_WalkForward;

View File

@ -41,6 +41,8 @@ static const struct {
{ CharState_WalkForward, "walkforward", Ogre::Vector3(0.0f, 1.0f, 0.0f) },
{ CharState_WalkBack, "walkback", Ogre::Vector3(0.0f, 1.0f, 0.0f) },
{ CharState_WalkLeft, "walkleft", Ogre::Vector3(1.0f, 0.0f, 0.0f) },
{ CharState_WalkRight, "walkright", Ogre::Vector3(1.0f, 0.0f, 0.0f) },
{ CharState_Dead, "death1", Ogre::Vector3(1.0f, 1.0f, 0.0f) },
};

View File

@ -19,6 +19,8 @@ enum CharacterState {
CharState_WalkForward,
CharState_WalkBack,
CharState_WalkLeft,
CharState_WalkRight,
CharState_Dead
};