difference of the movement?

exactly what does make the difference of movement?
could you explain the difference between getAxis and getkey

//first code

using UnityEngine;
using System.Collections;

public class playerscript : MonoBehaviour {

	public Vector2 speed= new Vector2(20,20);

	// Use this for initialization
	void Start () {
	 
	}
	
	// Update is called once per frame
	void Update () {

		float inputX = Input.GetAxis ("Horizontal");
		float inputY = Input.GetAxis ("Vertical");

		Vector3 movement= new Vector3 (speed.x*inputX,speed.y*inputY,0);
		movement *= Time.deltaTime;

		transform.Translate (movement);
	    }
   }


//second code

using UnityEngine;
using System.Collections;

public class move : MonoBehaviour {

	public float speed=5f;
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	   
		if(Input.GetKey("up"))
			{
			transform.Translate(0,speed*Time.deltaTime,0);
			} 

		if(Input.GetKey("down"))
		{
			transform.Translate(0,-speed*Time.deltaTime,0);
		}

		if(Input.GetKey("left"))
		{
			transform.Translate(-speed*Time.deltaTime,0,0);
		}

		if(Input.GetKey("right"))
		{
			transform.Translate(speed*Time.deltaTime,0,0);
		}
	}
}

@jinoh

In extremely simple terms: GetAxis() returns a value between -1 and 1 based on the negative and positive buttons pressed.

GetButton() and GetKey() both return a bool flag for either a pre-defined button or keycode. When the button or key is pressed it is true, when they are not it is false.

You can read up (in detail) on the differences between GetAxis(), GetButton() and GetKey() in both the scripting API and Unity Docs. I’ll link them below.

GetAxis - Unity Scripting API

GetButton - Unity Scripting API

Input - Unity Scripting API

Also there are numerous videos done by 3rd party tutorials and Unity themselves describing them I’ll also link these.

GetButton and GetKey - Unity Scripting Tutorials

GetAxis - Unity Scripting Tutorials

I would highly recommend, that before you continue asking questions, you at least check out the various scripting tutorials offered on Unity’s very own learn section. These cover most of the topics you will require to begin coding a game using Unity, along with some optimization and tips for your code. Also, the Unity docs and scripting API are highly useful resources of information and provide a lot of the detail you require already. This isn’t a dig, rather, a push towards better locations for you to learn. I hope this helps you! :slight_smile: