public float runSpeed = 5f; // controls player's speed
private float moveInput; // will tell the computer to move the player later on.
private Rigidbody2D rb; // this will be the rigidbody the forces will be applied to.
private void Start () {
rb = GetComponent<Rigidbody2D>(); // the game needs to know which object to apply forces to; it won't automatically know it's supposed to move the player
}
private void FixedUpdate()
{
moveInput = Input.GetAxis("Horizontal"); // Input.GetAxis("Horizontal") is a shortcut you can use in unity to use the arrow keys/ A&D keys to move forward
rb.velocity = new Vector2(moveInput * runSpeed, rb.velocity.y); // will cause the rigidbody to move depending on which buttons you press
}
/* This should get your character to move left and right, but not up/down. If you want them to move freely up and down, write :
moveInput = Input.GetAxis("Vertical"); right under moveInput = Input.GetAxis("Horizontal"); . Jumping is a little trickier.
since you need permission to use other people's work for this jam, I hereby declare that anyone participating in this gamejam can use this comment and it's contents to use in their games for whatever purpose. */