Diagonal Movement with Sprites

Hello, I’ve been having a dilemma with movement animations as I’ve been using a code like this

if (this.app.keyboard.isPressed(pc.KEY_W)) {
this.entity.sprite.play(“DemonUp”);
this.entity.rigidbody.applyForce(0.0,movementSpeed,0.0);
}

For every other key (W, A, S, D) I would use that code but with a different sprite animation. I also made one for idle animations:

if (this.app.keyboard.wasReleased(pc.KEY_W)) {
    this.entity.sprite.play("DemonUpIdle");
}

However, I don’t know what code to use to play a diagonal animation; as of yet, when I hold the keys W, and D, the sprite animation is stuck on one frame that it was previously on. Is there a way I can code pressing W and D at the same time to play a specific sprite animation? Thank you for any help if ever :slight_smile: