Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class NewBehaviourScript : MonoBehaviour {
  5.  
  6.     public Vector2 speed = new Vector2 (50, 50);
  7.  
  8.     void Update () {
  9.    
  10.         float inputX = Input.GetAxis ("Horizontal");
  11.         float inputY = Input.GetAxis ("Vertical");
  12.  
  13.         Vector3 movement = new Vector3 (speed.x * inputX, speed.y * inputY, 0);
  14.         movement *= Time.deltaTime;
  15.  
  16.         transform.Translate (movement, Space.World);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement