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;
- public float forcaPulo;
- private bool estaNoChao;
- public Transform chaoVerificador;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- Movimentacao();
- }
- void Movimentacao()
- {
- estaNoChao = Physics2D.Linecast(transform.position, chaoVerificador.position, 1 << LayerMask.NameToLayer("Piso"));
- if (Input.GetAxis("Horizontal") > 0)
- {
- transform.Translate(Vector2.right * velocidade * Time.deltaTime);
- transform.eulerAngles = new Vector2(0, 0);
- }
- if (Input.GetAxis("Horizontal") < 0)
- {
- transform.Translate(Vector2.right * velocidade * Time.deltaTime);
- transform.eulerAngles = new Vector2(0, 180);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement