Skip to main content
added 71 characters in body
Source Link
Zibelas
  • 5k
  • 2
  • 14
  • 26

While not the most elegant solution, you can simply check for all your input keys. | returns true if at least one of the conditions areis true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

Maybe later you want to switch it for your query against the input manager. Hard coded values are usually not best practice and the player won't be able to change his control to arrow keys or joystick.

 bool isWalking = (horizontalInput != 0) | (verticalInput != 0); 

While not the most elegant solution, you can simply check for all your input keys. | returns true if at least one of the conditions are true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

Maybe later you want to switch it for your query against the input manager. Hard coded values are usually not best practice and the player won't be able to change his control to arrow keys or joystick.

While not the most elegant solution, you can simply check for all your input keys. | returns true if at least one of the conditions is true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

Maybe later you want to switch it for your query against the input manager. Hard coded values are usually not best practice and the player won't be able to change his control to arrow keys or joystick.

 bool isWalking = (horizontalInput != 0) | (verticalInput != 0); 
added 207 characters in body
Source Link
Zibelas
  • 5k
  • 2
  • 14
  • 26

While not the most elegant solution, you can simply check for all your input keys. | returnreturns true if at least one of the conditions are true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

Maybe later you want to switch it for your query against the input manager. Hard coded values are usually not best practice and the player won't be able to change his control to arrow keys or joystick.

While not the most elegant solution, you can simply check for all your input keys. | return true if at least one of the conditions are true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

While not the most elegant solution, you can simply check for all your input keys. | returns true if at least one of the conditions are true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d"); 

Maybe later you want to switch it for your query against the input manager. Hard coded values are usually not best practice and the player won't be able to change his control to arrow keys or joystick.

Source Link
Zibelas
  • 5k
  • 2
  • 14
  • 26

While not the most elegant solution, you can simply check for all your input keys. | return true if at least one of the conditions are true.

 bool isWalking = Input.GetKey("w") | Input.GetKey("a") | Input.GetKey("s") | Input.GetKey("d");