Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PlayerController : MonoBehaviour {
- public float Speed = 5;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update ()
- {
- Move();
- }
- void Move()
- {
- if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0)
- {
- float distance = Speed * Time.deltaTime;
- float z = Input.GetAxis("Vertical") * distance;
- float x = Input.GetAxis("Horizontal") * distance;
- transform.Translate(x, 0, z);
- }
- }
- /*
- Copyright Shadowplay Coding 2018 - see www.shadowplaycoding.com for licensing details
- Removing this comment forfits any rights given to the user under licensing.
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement