Is it possible to have a diagonal movement animation in monogame/xna?
As far as I can tell it's not possible to recognise multiple keypresses (ie "A && W" or "S && D") as unique events - everything I've seen regarding diagonal movement basically goes;
if(W)
{
player.position.x = player.position.x + 1
}
if(S)
{
player.position.x = player.position.x - 1
}
if(A)
{
player.position.y = player.position.y - 1
}
if(D)
{
player.position.y = player.position.y + 1
}
And that obviously works in most instances, my problem is I have specific diagonal movement animations that I need to display, my characters are people and I can't just rotate them like a ship or a car - and as far as I can tell....
if(W && A)
{
player.position.x = player.position.x + 1
player.position.y = player.position.y - 1
}
Isn't possible?
The only way I can think to accomplish what I need is to detect diagonal movement after the input handling - ie if both x AND y positions are different or are going to be different to the previous position, set the relevant diagonal to true and show the relevant animation.
Is there a 'correct' or easier way to do this?