Last active
June 17, 2019 20:49
-
-
Save vjgrayman/e7702fdf10cf2ee4386a5ab7763e5f8a to your computer and use it in GitHub Desktop.
SimpleMovement using defgault Input Keys, and Control Speed #CSharp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class PlayerMovement : MonoBehaviour | |
{ | |
[SerializeField] | |
private float _speed; | |
[SerializeField] | |
private float _horizontalInput; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
_horizontalInput = Input.GetAxis("Horizontal"); | |
transform.Translate(new Vector3(_horizontalInput,0,0) * _speed * Time.deltaTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment