daily pastebin goal
9%
SHARE
TWEET

Jump Script

a guest Jul 19th, 2015 1 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma strict
  2.  
  3. var grounded = false;
  4.  
  5. function Start () {
  6.        
  7. }
  8.  
  9. function Update () {
  10.         if (Input.touchCount > 0){
  11.                 if (grounded == true){
  12.                         GetComponent.<Rigidbody>().AddForce(0,250,0);
  13.                         grounded = false;
  14.                 }
  15.                
  16.         }
  17.        
  18.         if (Input.GetKeyDown("space")){
  19.                 if (grounded == true){
  20.                         GetComponent.<Rigidbody>().AddForce(0,250,0);
  21.                         grounded = false;
  22.                 }
  23.         }
  24.        
  25. }
  26.  
  27. function OnCollisionEnter(hit: Collision) {
  28.     grounded = true;
  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
 
Top