daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Mar 23rd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using UnityEngine;
  3.  
  4. public class PlayerController : MonoBehaviour
  5. {
  6.     public float moveSpeedup;
  7.     public float moveSpeeddown;
  8.     public float rotateSpeed;
  9.     public bool moveup;
  10.     public bool movedown;
  11.     public bool rotateleft;
  12.     public bool rotateright;
  13.     void Update()
  14.     {
  15.         if ((Input.GetKey(KeyCode.UpArrow)) || moveup)
  16.         {
  17.             transform.Translate(Vector3.right * moveSpeedup * Time.deltaTime);
  18.         }
  19.         if (Input.GetKey(KeyCode.DownArrow) || movedown)
  20.         {
  21.             transform.Translate(-Vector3.right * moveSpeeddown * Time.deltaTime);
  22.         }
  23.         if (Input.GetKey(KeyCode.RightArrow) || rotateleft)
  24.         {
  25.             transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
  26.         }
  27.         if (Input.GetKey(KeyCode.LeftArrow) || rotateright)
  28.         {
  29.             transform.Rotate(Vector3.forward * -rotateSpeed * Time.deltaTime);
  30.         }
  31.     }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top