What I am trying to do is make it so that when you press key W with S you will not move forward or backwards, when you press A and D together you will not move left or right, and when you press them all together you will not move in any direction.
What I have so far is this:
if( Input.GetKey(KeyCode.S) Input.GetKey(KeyCode.W)) {
inputY = 0.0;
} else {
inputY = Input.GetAxis("Vertical");
}
if( Input.GetKey(KeyCode.A) Input.GetKey(KeyCode.D)) {
inputX = 0.0;
} else {
inputX = Input.GetAxis("Horizontal");
}
The problem is it doesnt work perfectly, for example:
The first part works fime, like when you press W and S it wont move backward or forward, and when you press A and D it wont move left and right but the problem comes in when combining them. If I pess A and D then Press W and S in that order it will stop the left to right movement but will still allow me to move forward and backward and will not stop movement entirely. Though when I press W and S and then A and D it will stop movement entirely and not allow me to move at all.
Im not sure exactly why its doing this, maybe there is a workaround or some other way to achieve this effect.
Any help is greatly appreciated and thanks for your time!