Skip to content

Instantly share code, notes, and snippets.

@xSystemIOx
Last active January 29, 2024 19:05
Show Gist options
  • Save xSystemIOx/e4af423f5a0d4136e4052695fbcd9b9c to your computer and use it in GitHub Desktop.
Save xSystemIOx/e4af423f5a0d4136e4052695fbcd9b9c to your computer and use it in GitHub Desktop.
2D Character movement Left/Right script for C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Move : MonoBehaviour {
private CharacterController player;
public float Speed;
void Start () {
player = GetComponent<CharacterController> ();
}
void Update () {
Vector3 Move = Vector3.zero;
Move.x = Input.GetAxis ("Horizontal") * Speed;
player.Move(Move * Time.deltaTime);
}
}
@RealBoy5274
Copy link

i love this script i use it for my game undexruner great job making this script keep up the good work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment