Advertisement
Sabotender

SimpleMove Unity script for The Gathering 2015

May 26th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class SimpleMove : MonoBehaviour {
  5.     public float moveSpeed = 1;
  6.  
  7.     // Use this for initialization
  8.     void Start () {
  9.        
  10.     }
  11.    
  12.     // Update is called once per frame
  13.     void Update () {
  14.         /*
  15.         if(Input.GetKey(KeyCode.LeftArrow)) {
  16.             transform.position += new Vector3(moveSpeed * Time.deltaTime, 0, 0);
  17.         }
  18.         if(Input.GetKey(KeyCode.RightArrow)) {
  19.             transform.position += new Vector3(-moveSpeed * Time.deltaTime, 0, 0);
  20.         }
  21.         */
  22.  
  23.         transform.position += Vector3.right * Input.GetAxis("Horizontal") * Time.deltaTime * moveSpeed;
  24.  
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement