Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using UnityEngine;
- public class PlayerController : MonoBehaviour
- {
- public float moveSpeedup;
- public float moveSpeeddown;
- public float rotateSpeed;
- public bool moveup;
- public bool movedown;
- public bool rotateleft;
- public bool rotateright;
- void Update()
- {
- if ((Input.GetKey(KeyCode.UpArrow)) || moveup)
- {
- transform.Translate(Vector3.right * moveSpeedup * Time.deltaTime);
- }
- if (Input.GetKey(KeyCode.DownArrow) || movedown)
- {
- transform.Translate(-Vector3.right * moveSpeeddown * Time.deltaTime);
- }
- if (Input.GetKey(KeyCode.RightArrow) || rotateleft)
- {
- transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
- }
- if (Input.GetKey(KeyCode.LeftArrow) || rotateright)
- {
- transform.Rotate(Vector3.forward * -rotateSpeed * Time.deltaTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement