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 MovementScript : MonoBehaviour
- {
- public float FwdSpeed = 1f;
- void Start()
- {
- Cursor.visible = false;
- }
- void Update()
- {
- if (Input.GetKeyDown("escape"))
- Cursor.visible = true;
- if (Input.GetKey (KeyCode.W))
- {
- transform.Translate (Vector3.forward * Time.deltaTime * FwdSpeed);
- }
- else if (Input.GetKey (KeyCode.S))
- {
- transform.Translate (Vector3.back * Time.deltaTime * FwdSpeed);
- }
- }
- }
Advertisement
RAW Paste Data
Copied
Advertisement