Advertisement
rodrigofbm

Untitled

Apr 30th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var pulo : int = 60;
  2.  
  3.         if(Input.GetButtonDown("Jump") && Chao)
  4.             {
  5.                 GetComponent.<Rigidbody2D>().velocity.y = pulo;
  6.             }
  7.         if(Input.GetButtonUp("Jump") && !Chao && GetComponent.<Rigidbody2D>().velocity.y >0)
  8.             {
  9.                 GetComponent.<Rigidbody2D>().velocity.y = GetComponent.<Rigidbody2D>().velocity.y/2;
  10.             }
  11. //usei Raycasting para detectar o chao, quando os pés do personagem tocar num collider Chao vai ser true etc...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement