SHARE
TWEET

Untitled

a guest Sep 27th, 2016 39 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Player : MonoBehaviour {
  5.  
  6.     public float velocidade;
  7.    
  8.     // Use this for initialization
  9.     void Start () {
  10.  
  11.     }
  12.  
  13.     // Update is called once per frame
  14.     void Update () {
  15.         Movimentacao();
  16.     }
  17.  
  18.     void Movimentacao() {
  19.  
  20.         if (Input.GetAxisRaw("Horizontal") > 0 )
  21.             transform.Translate (Vector2.right * velocidade * Time.deltaTime);
  22.         else if (Input.GetAxisRaw("Horizontal") < 0 )
  23.             transform.Translate (-Vector2.right * velocidade * Time.deltaTime);
  24.         else if (Input.GetAxisRaw("Vertical") > 0 )
  25.             transform.Translate (Vector2.up * velocidade * Time.deltaTime);
  26.         else if (Input.GetAxisRaw("Vertical") < 0 )
  27.             transform.Translate (-Vector2.up * velocidade * Time.deltaTime);
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top