Created
July 10, 2016 17:37
-
-
Save ted80/849876c928e2339f5f72b5e1c3c79540 to your computer and use it in GitHub Desktop.
This file contains 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 UnityEngine; | |
using System.Collections; | |
public class CameraMovement : MonoBehaviour | |
{ | |
[Range(0.2f, 4f)] | |
public float speed = 1f; | |
void Update () | |
{ | |
if(Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) | |
{ | |
gameObject.transform.position += -(gameObject.transform.right * speed * 12f * Time.deltaTime); | |
} | |
if(Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) | |
{ | |
gameObject.transform.position += (gameObject.transform.right * speed * 12f * Time.deltaTime); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment