Created
February 15, 2021 18:45
-
-
Save doyle-flutter/a14f8848c40301ef5a318edd1fb9d956 to your computer and use it in GitHub Desktop.
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 UserContoller : MonoBehaviour | |
| { | |
| private Vector3 vector; | |
| public float speed = 0.5F; | |
| // Start is called before the first frame update | |
| void Start() | |
| { | |
| } | |
| // Update is called once per frame | |
| void Update() | |
| { | |
| vector.Set(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"), 0); | |
| if(vector.x != 0 || vector.y != 0){ | |
| transform.Translate(vector.x * speed, vector.y * speed, 0); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment