View Single Post
Old 07-04-2008, 12:10 PM   #4 (permalink)
DiNoGames
zB Programmer
Jr. Member
 
DiNoGames's Avatar
 
Join Date: May 2008
Location: Bremen, germany
Posts: 454
Reputation: 248
Send a message via Skype™ to DiNoGames
Default

Quote:
Originally Posted by Rockman87 View Post
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?
__________________

To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 0 or greater. You currently have 0 posts.







DiNoGames is offline   Reply With Quote