Actor moving problem

Hey,
I already coded the part with
a -> actor.x -= 5;
d -> actor.x += 5;
w -> actor.y -= 5;
s -> actor.y += 5;
know if I press d and then w my actor moves x + 5 and y - 5, but I want my actor only move in one direction.
example:
d and then w : x + 5
s and then d : y + 5
how can I do that?
I already coded the part with
a -> actor.x -= 5;
d -> actor.x += 5;
w -> actor.y -= 5;
s -> actor.y += 5;
know if I press d and then w my actor moves x + 5 and y - 5, but I want my actor only move in one direction.
example:
d and then w : x + 5
s and then d : y + 5
how can I do that?