My game is in 2d (doodle jump style) and in my dumb brain i thought this was an input to the accelerometer how can i fix it?
[RequireComponent(typeof(Rigidbody2D))]
public class player : MonoBehaviour {
public float movementSpeed = 10f;
Rigidbody2D rb;
float movement = 0f;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update () {
movement = Input.GetAxis("Horizontal") * movementSpeed;
}
private void FixedUpdate()
{
Vector2 velocity = rb.velocity;
velocity.x = movement;
rb.velocity = velocity;
}
public void SetSpeed(float modifier)
{
movementSpeed = 10f + modifier;
}