Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Sprite still doesnt work..??

$
0
0

@Kane_de_Crook wrote:

Hey guys i am trying to make my 2d character (Sprite) to Idle in a certain direction

So first i just wanted it to just idle when there was no input so i made this:

if (Velocity.X == 0)
animationManager.Play(animations["WalkIdle"]);

Thats what i added to my other code i already had just to walk:

if (Velocity.X > 0)
animationManager.Play(animations["WalkRight"]);
else if (Velocity.X < 0)
animationManager.Play(animations["WalkLeft"]);
else if (Velocity.Y > 0)
animationManager.Play(animations["WalkDown"]);
else if (Velocity.Y < 0)
animationManager.Play(animations["WalkUp"]);

But now my question is How can i let it idle a certain direction??
this is what i made but i didnt work and it just displayed the IdleDown animation the whole time:

if (Velocity.X > 0)
animationManager.Play(animations["WalkRight"]);
else if (Velocity.X < 0)
animationManager.Play(animations["WalkLeft"]);
else if (Velocity.Y > 0)
animationManager.Play(animations["WalkDown"]);
else if (Velocity.Y < 0)
animationManager.Play(animations["WalkUp"]);
else if (Velocity.Y <= 0)
animationManager.Play(animations["WalkIdleDown"]);
else if (Velocity.Y >= 0)
animationManager.Play(animations["WalkIdleUp"]);
else if (Velocity.X <= 0)
animationManager.Play(animations["WalkIdleRight"]);
else if (Velocity.X >= 0)
animationManager.Play(animations["WalkIdleLeft"]);

What am i doing Wrong??

please send me code and dont tell me what to do cause my english is pretty bad :frowning:

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles