You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FlyingFred/Assets/CharacterController.cs

14 lines
360 B
C#

using UnityEngine;
public class CharacterController : MonoBehaviour
{
public Rigidbody2D characterRigidbody;
public float swingForce = 10f;
void Update()
{
// Control the character with horizontal input
float input = Input.GetAxis("Horizontal");
characterRigidbody.AddForce(Vector2.right * input * swingForce);
}
}