Quote:
Originally Posted by Rockman87
Code:
if (vert == 1)
{
if (pose == 1)
spriteBatch.Draw(walkDown1, personPos, Color.White);
else
spriteBatch.Draw(walkDown2, personPos, Color.White);
}
else
{
if (pose == 1)
spriteBatch.Draw(walkUp1, personPos, Color.White);
else
spriteBatch.Draw(walkUp2, personPos, Color.White);
}
if (horiz == -1)
{
if (pose == 1)
spriteBatch.Draw(walkLeft1, personPos, Color.White);
else
spriteBatch.Draw(walkLeft2, personPos, Color.White);
}
else
{
if (pose == 1)
spriteBatch.Draw(walkRight1, personPos, Color.White);
else
spriteBatch.Draw(walkRight2, personPos, Color.White);
}
spriteBatch.Draw(monster, monsterPos, Color.White);
pose = pose * -1;
|
I bet your code draws the vertical movement. But you do not notice because no matter if you walk vertical, you draw a horizontal sprite over the vertical one, speak you draw the horizontal sprite always.
Why?
Because you check if horiz is -1 and what if it zero (as supposed when you do not walk horizontally)? Well, instead of doing nothing you say: ELSE
So no matter which value is stored in horiz (including 0), when its unequal to -1 it goes through the following code:
Code:
if (pose == 1)
spriteBatch.Draw(walkRight1, personPos, Color.White);
else
spriteBatch.Draw(walkRight2, personPos, Color.White);
Can you see your problem?