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.
14 lines
360 B
C#
14 lines
360 B
C#
6 days ago
|
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);
|
||
|
}
|
||
|
}
|