How to implement the game "Dancing line"'s body movement

Hi, I was looking at a game called: Dancing Line (https://play.google.com/store/apps/details?id=com.cmplay.dancingline). I really like the looking of the game and I was asking myself: How do they make the “snake”'s body in the game?

public GameObject Actor;
public float speed = 1;
private Vector3 pos;
public Material mat;
private int loopCount = 1;
public bool onGround = true;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	pos = Actor.transform.position;
	Actor.transform.Translate (Vector3.forward * speed * Time.deltaTime);
	if (onGround == true)
	{
		GameObject Actor2 = GameObject.CreatePrimitive(PrimitiveType.Cube);
		Actor2.transform.position = pos;
		Actor2.GetComponent<MeshRenderer>().material = mat;
		Actor2.GetComponent<BoxCollider> ().isTrigger = true;
		if (Input.GetKeyDown("space"))
		{
			if (loopCount % 2 != 0) 
			{
				Actor.transform.eulerAngles = new Vector3 (0, 90, 0);
				loopCount++;
			}
			else
			{
				Actor.transform.eulerAngles = new Vector3 (0, 180, 0);
				loopCount++;
			}
		}
	}
}

}

This script should do the snake part, just click your left mouse button to move it, but i have no idea how to make the stop and press to start part and this is C# Script