I’m having trouble understanding how to move the player using GetButton. I’m used to doing it with GetKey but I wanted to learn this way this time around. I looked into the Input Axes and see how Vertical has a positive and negative button (w and s respectively). I’m having difficulty writing code with GetButton to make my character move forward without adding an if statement with GetKey which is wrong and redundant.
Additionally, I don’t know how using GetButton(“Vertical”) will know the difference of w or s key without me stating so with GetKey.
I’m sure this is all very basic to you guys but I can’t figure it out and am not having much luck understanding the docs and google searches I’ve encountered.
For clarity I understand I could do something like:
if(Input.GetButton(“Vertical”))
{
//move player here
}
What I don’t get really is how to discern whether it is the w or s (backwards) key being pressed. Also is there a better way of setting up movement than the simple if statement way I presented?