top down movement script C# code example
Example 1: c# movement script
private float speed = 2.0f;
public GameObject character;
void Update () {
if (Input.GetKey(KeyCode.RightArrow)){
transform.position += Vector3.right * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.LeftArrow)){
transform.position += Vector3.left * speed * Time.deltaTime;
}
if (Input.GetKey(KeyCode.UpArrow)){
transform.position += Vector3.up*speed* Time.deltaTime;
}forward;
if (Input.GetKey(KeyCode.DownArrow)){
transform.position += Vector3.down *speed * Time.deltaTime;
}
}
Example 2: c# movement script
Look at dani tutorials