input on the x and y will be between 1 and -1 depending on the player's actions (0 if they are not touching anything ;)).
mutiplying these by set values will convert these actions into movement at in this case the max speed of 50.
this is kind-of crude, and does not create acceleration decelleration.
If I wantes smooth play, I'd think of :
public int speed=50;//they are same, so why bother with vector2
private Vector2 movement=new Vector2(0,0);
movement+=new Vector2(speed * inputX,speed * inputY)*Time.deltaTime;
//reach optimal speed in roughly a second
movement*=(1-Time.deltaTime);
//slow down in roughly a second.
↧