Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Player : MonoBehaviour {
- public float velocidade;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- Movimentacao();
- }
- void Movimentacao() {
- if (Input.GetAxisRaw("Horizontal") > 0 )
- transform.Translate (Vector2.right * velocidade * Time.deltaTime);
- else if (Input.GetAxisRaw("Horizontal") < 0 )
- transform.Translate (-Vector2.right * velocidade * Time.deltaTime);
- else if (Input.GetAxisRaw("Vertical") > 0 )
- transform.Translate (Vector2.up * velocidade * Time.deltaTime);
- else if (Input.GetAxisRaw("Vertical") < 0 )
- transform.Translate (-Vector2.up * velocidade * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement