Hello,
So I am trying to make a game here where the character moves around in a grid-less RPG style. I am using “Input.GetAxis” for getting key presses for movement but instead of just acting like “0” when the key is not pressed and then changing to “1” when the key is pressed it quickly goes from 0 and counts all they way up to 1 using decimal numbers. I basically just want it to instantly snap to 1 or -1 from 0. Here is a chunk of my code that controls the movement and movement speed.
void FixedUpdate()
{
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
HandleMovement(horizontal, vertical);
Facing(vertical);
}
void HandleMovement(float horizontal, float vertical)
{
playerRigidbody.velocity = new Vector2(horizontal * speed, vertical * speed);
}