using UnityEngine;
using System.Collections;

public class Jojo : MonoBehaviour {
    public float speedAdjust = 4f;

    void Update() {
        HingeJoint2D joint = GetComponent<HingeJoint2D>();
        float direction = Input.GetAxis("Vertical");
        float newY = Mathf.Clamp(joint.anchor.y - direction / speedAdjust, 1, 5);
        joint.anchor = new Vector2(0, newY);
    }
}
