- Home /
Question by
alkebulan · Apr 04, 2015 at 08:32 PM ·
input.getaxis
How do I correct no response from input keys
I'm using the Rogue-like tutorial and I keep failing to get the input controls correct. Either I get nothing or arrow keys do not take player more than one space right or up. My code straight from tutorial script online:
if(!GameManager.instance.playersTurn) return;
int horizontal = 0; //Used to store the horizontal move direction.
int vertical = 0; //Used to store the vertical move direction.
horizontal = (int) (Input.GetAxisRaw ("Horizontal"));
vertical = (int) (Input.GetAxisRaw ("Vertical"));
if(horizontal != 0)
{
vertical = 0;
}
if(horizontal != 0 || vertical != 0)
{
AttemptMove<Wall> (horizontal, vertical);
}
Comment